Open jdhardy opened 10 years ago
It looks like itertools.repeat
, list_iterator
, list_reverseiterator
, dict_keyiterator
, and reversed
all currently implement __length_hint__()
, and the current version of the standard library includes operator.length_hint()
.
Can this issue be closed? It does not look like we currently make use of the __length_hint__
anywhere; do we want to investigate any potential performance gains from using this information? E.g. the following Python code does not allocate the correct size backing array, but could.
list(iter([1,2,3,4,5]))
I'd like to get most of test_iterlen
passing before this one is closed. For example, the following don't have length hints: rangeiterator
(which should be renamed to range_iterator
), tupleiterator
(which should be renamed to range_iterator
), deque_iterator
and so on.
http://www.python.org/dev/peps/pep-0424/