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

Jon Ribbens jon+usenet at unequivocal.co.uk
Thu Nov 7 12:12:02 EST 2002


In article <j465v93g42.fsf at informatik.hu-berlin.de>, Martin v. Löwis wrote:
>> I don't really like the idea of hacking around with the warning
>> module, so I guess I'll replace 0x80000000 with (-0x7fffffff-1) which
>> won't generate a warning on any version of Python and will work on all
>> versions... I think ;-)
> 
> I would still recommend to use 0x8000000L instead; it saves you one
> computation, and is more readable.

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.



More information about the Python-list mailing list