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

Alex Gaynor alex.gaynor at gmail.com
Tue Jul 17 05:03:08 CEST 2012


I've updated the PEP to reflect the discussion. There are two major changes:

1) NotImplemented may be used by __length_hint__ to indicate that there is no 
   finite length hint available.
2) callers of operator.length_hint() must provide their own default value, this
   is also required by the current C _PyObject_LengthHint implementation.

There are no provisions for infinite iterators, that is not within the scope of
this proposal.

Alex



More information about the Python-Dev mailing list