Strange range

Jussi Piitulainen jussi.piitulainen at helsinki.fi
Fri Apr 1 10:44:42 EDT 2016


Marko Rauhamaa writes:
> Chris Angelico wrote:
>
>> *A range object is not an iterator.*
>
> We now have learned as much.
>
> However, doesn't that extra level of indirection seem like an odd
> choice?

I think it's brilliant. The range object behaves like a tuple containing
the numbers in the range, one can index it, slice it, zip it, for it,
like it, without it taking up the space or getting consumed in the
process.



More information about the Python-list mailing list