Message54215
These restrictions are undocumented both in the
xrange doc string and in the reference manual
(Info node 'XRange Type'):
>>> xrange(maxint, maxint + 10)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: long int too large to convert to int
>>> xrange(-100, maxint)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: xrange() result has too many items
I hope the overflows below are bugs and not
features. It works if 3/-3 is replaced with 1/-1:
>>> xrange(0, maxint, 3)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: integer addition
>>> xrange(0, -maxint, -3)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: integer addition
Python installation:
Python 2.3.3 (#1, May 25 2004, 20:22:36)
[GCC 3.2.3] on sunos5
Type "help", "copyright", "credits" or "license"
for more information.
>>> from sys import maxint
>>> "%x" % maxint
'7fffffff'
|
|
Date |
User |
Action |
Args |
2007-08-23 16:08:16 | admin | link | issue1003935 messages |
2007-08-23 16:08:16 | admin | create | |
|