range or xrange disallowed for big numbers

Chad Netzer cnetzer at mail.arc.nasa.gov
Fri Oct 4 17:32:04 EDT 2002


Is there a reason (technical or philosophical) to disallow:

    range( 10000000000L, 10000000000L + 1L )

or 

    xrange( 10000000000L )

etc...?

Clearly, these case are not limited by memory consumption, and 
especially in the xrange case, I would think very large numbers should 
be allowed (at least, reasonable ranges of very large numbers, which 
can have their uses).  I actually found a bug in a plotting backage, 
due to this (I'll inform the authors).

~~~~~~
Python 2.3a0 (#2, Sep 22 2002, 18:58:21) 
[GCC 3.2.1 20020912 (Debian prerelease)] on linux2

>>> xrange(10000000000L)
OverflowError: long int too large to convert to int

>>> range(10000000000L, 10000000000L + 1L)
OverflowError: long int too large to convert to int
~~~~~~

I'd be happy to prepare a patch for Python2.3 (and earlier), if it 
isn't unreasonable to do.

-- 

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list