Martin v. Löwis wrote:
 > This is a bug, right?

I'd call it an implementation limitation.
This is because I'm in a 32 bit machine?

Right. The assumption is that you typically use
the range elements to index into some collections,
and you can't have collections with more than 2**32
elements (actually, address space is exhausted at
2**29 elements already, except for str and unicode).

It would be possible to make it support larger
ranges, but then the common case would get slower,
and the code would be more convoluted.

There's definitely some bugs in this area of the range object code though:

>>> x = range(2**33, 2)
>>> len(x)
0
>>> x[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: range object index out of range

I also believe that the OverflowError from doing len(self) while attempting to index into the range should be intercepted and converted to something more meaningful for the actual operation requested by the programmer (e.g. "ValueError: Cannot index range objects with sys.maxsize or more elements")

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://www.boredomandlaziness.org
_______________________________________________
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