Message307274
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. |
|
| Date |
User |
Action |
Args |
| 2017-11-29 23:11:36 | steven.daprano | set | recipients:
+ steven.daprano, bugale bugale |
| 2017-11-29 23:11:36 | steven.daprano | set | messageid: <1511997096.32.0.213398074469.issue32172@psf.upfronthosting.co.za> |
| 2017-11-29 23:11:36 | steven.daprano | link | issue32172 messages |
| 2017-11-29 23:11:36 | steven.daprano | create | |
|