Mark Shannon, 15.07.2012 16:14:
> Alex Gaynor wrote:
>> CPython currently defines an ``__length_hint__`` method on several types,
>> such
>> as various iterators. This method is then used by various other functions
>> (such as ``map``) to presize lists based on the estimated returned by
> 
> Don't use "map" as an example.
> map returns an iterator so it doesn't need __length_hint__

Right. It's a good example for something else, though. As I mentioned
before, iterators should be able to propagate the length hint of an
underlying iterator, e.g. in generator expressions or map(). I consider
that an important feature that the protocol must support.

Stefan

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to