[Python-Dev] PEP 0424: A method for exposing a length hint

Stefan Behnel stefan_ml at behnel.de
Mon Jul 16 10:53:54 CEST 2012


Nick Coghlan, 16.07.2012 10:26:
> Proposing anything substantially more complicated than what is currently
> implemented in CPython will just get the idea rejected. The substantial
> immediate gain for PyPy is in skipping the memory resizing when building
> containers from itertools iterators, not anywhere else.

The same applies to Cython, where the extension types that implement
generator expressions can benefit from propagating the length hint of the
underlying iterator. A type slot would help in making this more efficient
overall, also for CPython itself.

Stefan



More information about the Python-Dev mailing list