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

Jon Ribbens jon+usenet at unequivocal.co.uk
Wed Nov 6 18:40:46 EST 2002


In article <jwbaxter-E8FADF.14412506112002 at corp-radius.supernews.com>, John Baxter 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 ;-)
> 
> 64bit integers?

Why do you think that will make any difference? I just want to set
bit 31 of the integer, and I don't care if the integer is 32 bits
signed, 32 bits unsigned, or >32 bits, I just want to set bit 31,
the addition operator and struct.pack("!I") will still make the same
output no matter what type of integer they're getting (unless they're
buggy ;-) )



More information about the Python-list mailing list