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

Martin v. Löwis loewis at informatik.hu-berlin.de
Thu Nov 7 04:11:10 EST 2002


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

> > You can if you want.  The PEP continues to allow it until Python 3.0.
> 
> According to the PEP, Python 2.5 will print warnings whenever you use
> long literals.  If the OP doesn't want warnings, he'll have to change his
> code for 2.3, and change it back for 2.5.

It is quite difficult to predict the future, and I would suggest that
the OP ignores predictions that the PEP makes about what phases will
be implemented in what Python version.

My personal prediction is that Python 2.5 will not warn about long
literals.

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

You mean, long("80000000",16)?

Python 1.5.2 (#4, Jul 4 2000, 19:57:05) [GCC 2.95.2 19991024
(release)] on sunos5
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> long("80000000",16)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: long requires exactly 1 argument; 2 given

Regards,
Martin



More information about the Python-list mailing list