hex/oct constants > sys.maxint will return positive values in Python 2.4 and up

Thomas Heller thomas.heller at ion-tof.com
Thu Nov 7 03:18:35 EST 2002


"Fredrik Lundh" <fredrik at pythonware.com> writes:

> Looks like the only portable way to use large "unsigned" constants is to
> use long("0x80000000")...
> 
> </F>

Doesn't work for me in *any* Python version I have:

Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> long("0x80000000")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for long(): 0x80000000
>>>

long("0x80000000", 16) works starting with 2.0, but not in 1.5.2.

Thomas



More information about the Python-list mailing list