➜

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients alex, rhettinger, serhiy.storchaka, vstinner
Date 2016-04-22.12:57:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
> 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 ;-)
History
Date User Action Args
2016-04-22 12:57:55vstinnersetrecipients: + vstinner, rhettinger, alex, serhiy.storchaka
2016-04-22 12:57:55vstinnersetmessageid: <[email protected]>
2016-04-22 12:57:55vstinnerlinkissue26828 messages
2016-04-22 12:57:55vstinnercreate