Hi all!

Used to be able to do this...

>>> l = (x for x in range(10))
>>> l.__next__()
0
>>> l.__next__()
1

...I tried the following:

>>> r = range(5)
>>> r
range(0, 5)
>>> r.__next__
Traceback (most recent call last):
...
AttributeError: 'range' object has no attribute '__next__'


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

Furthermore, I took a look inside, and found a __getitem__, so I tried

>>> r[4]
4

which apparently works, but see:

>>> 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?

Thank you very much!!

Regards,

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
_______________________________________________
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