This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients bugale bugale, steven.daprano
Date 2017-11-29.23:11:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1511997096.32.0.213398074469.issue32172@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-11-29 23:11:36steven.dapranosetrecipients: + steven.daprano, bugale bugale
2017-11-29 23:11:36steven.dapranosetmessageid: <1511997096.32.0.213398074469.issue32172@psf.upfronthosting.co.za>
2017-11-29 23:11:36steven.dapranolinkissue32172 messages
2017-11-29 23:11:36steven.dapranocreate