[issue32172] Add length counter for iterables
Steven D'Aprano
report at bugs.python.org
Wed Nov 29 18:11:36 EST 2017
Steven D'Aprano <steve+python at pearwood.info> added the comment:
Not every trivial one-liner needs to be in the standard library. In this case, there are two easy (and obvious) ways to do it:
sum(1 for x in iterator)
len(list(iterator))
(The first probably saves memory; the second probably is faster.)
Given how rare it is to care ONLY about the length of an iterator, I see no reason why this needs to be in the std lib. If you disagree, please take it to the Python-Ideas mailing list to get community support first before re-opening this ticket.
----------
nosy: +steven.daprano
resolution: -> rejected
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32172>
_______________________________________
More information about the Python-bugs-list
mailing list