long int behaviour

Timothy Grant tjg at exceptionalminds.com
Thu Mar 1 02:29:37 CET 2001

Hi again,

I have a question about longs that has come about due to my
question and the discussion of IP math a couple of days ago.

I'm doing ok on the math part, I still have some issues I need
to work through, but I think I will have it all nailed down
shortly (the exercise has been very informative and
educational).  I do have a question about longs and their
behaviour. Given the following experimenting...

>>> hex(4294965248L)
>>> hex(~4294965248L)

The first output is what I would expect, however, I would have
expected the second output to be


It appears to be something to do with two's complement storage,
but I'm at a loss as to why my expectations were so incorrect.

Stand Fast,

Timothy Grant                         tjg at exceptionalminds.com
Red Hat Certified Engineer            www.exceptionalminds.com
Avalon Technology Group, Inc.         <><       (503) 246-3630
>>>>>>>>>>>>>Linux, because rebooting is *NOT* normal<<<<<<<<<
>>>>This machine was last rebooted:  43 days  5:37 hours ago<<

More information about the Python-list mailing list