> Which is the normal way to "consume" a range object, item by item?

The normal way is a for loop.

The advanced way of invoking some method on the object (i.e. emulating
the for loop) is to first create an iterator from the range object.
You can't consume the range itself: it will always contain the same
numbers - just like you can't consume a list.

>>>> r = range(10000000000000000000)
>>>> r[0]
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>     OverflowError: Python int too large to convert to C ssize_t
> 
> This is a bug, right?

I'd call it an implementation limitation.

Regards,
Martin
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to