Integer Overflow

Fernando Pérez fperez528 at
Mon Nov 26 13:41:23 CET 2001

Ursus Horibilis wrote:

> Thanks very much.  I did not realize that a Python long was not
> simply a 64-bit number.  Just pure ignorance on my part.  Is it
> legal to mask a long and assign it to an int?  For example:
> (a) is an (int), (b) is a (long)
> b = 6*sys.maxint
> a = b & (0xFFFFFFFF)

That's just what I suggested in another post, though I've never played with 
bit-operators in python. (but remember to use 6L when assigning to b, not 6: 
that will make b a long).



More information about the Python-list mailing list