Message264010
> But note that map() and zip() take several iterables, and we should call __length_hint__() for every of them (unless found a one with not implemented __length_hint__()). This can slow down the execution for short sequences.
Oh, there is no slot for __length_hint__(). Maybe we should also try to add a new slot for it?
Maybe we can use a fast-path for the most common cases like list(map(func, list))?
> It is impossible to implement reasonable filter.__length_hint__(), because the length of resulting sequence can be from 0 to the length of the input sequence, and returning the maximal value would be not correct.
What I see is that Python 2 is much faster and Python 2 reallocates N items if the input sequence contains N items. But yeah, we have to benchmark such change on Python 3 ;-) |
|
Date |
User |
Action |
Args |
2016-04-22 12:57:55 | vstinner | set | recipients:
+ vstinner, rhettinger, alex, serhiy.storchaka |
2016-04-22 12:57:55 | vstinner | set | messageid: <1461329875.78.0.520347342807.issue26828@psf.upfronthosting.co.za> |
2016-04-22 12:57:55 | vstinner | link | issue26828 messages |
2016-04-22 12:57:55 | vstinner | create | |
|