[Python-ideas] Make len() usable on a generator

Ian Cordasco graffatcolmingov at gmail.com
Fri Oct 3 18:27:51 CEST 2014


On Fri, Oct 3, 2014 at 11:20 AM, Alexander Belopolsky
<alexander.belopolsky at gmail.com> wrote:
>
> On Fri, Oct 3, 2014 at 11:48 AM, Cathal Garvey
> <cathalgarvey at cathalgarvey.me> wrote:
>>
>> Some builtin generators appear to do just this:
>>
>> In [10]: %timeit  len(range(100))
>
>
> Builtin range is not a generator.

It is on Python 3 (but not Python 2):

$ python3
>>> range(100000)
range(0, 100000)

And I assumed that most discussion for Python-ideas pertained to
features for Python 3, am I incorrect in that?


More information about the Python-ideas mailing list