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

Tim Peters tim.one at comcast.net
Thu Nov 7 12:23:51 EST 2002


[Martin v. Löwis]
> I would still recommend to use 0x8000000L instead;

I recommend another trailing 0 <wink>.

> it saves you one computation, and is more readable.

[Jon Ribbens]
> But that *won't work* on later versions of Python!  It means I will
> have a line in my code which I know will suddenly stop working at some
> point in the future and I will have to make a new release and everyone
> will have to upgrade their copies of my module just because I put in
> code which I knew wasn't going to work.

There's no code you can write today that's guaranteed to work in Python 3.0.

In the Python 2 line, do as Martin keeps suggesting you do.  Note that the
line about adding warnings for long literals in 2.5 has been removed from
the PEP.






More information about the Python-list mailing list