~ 1 = -2 ???

Les Schaffer godzilla at netmeg.net
Fri Nov 5 05:01:22 CET 1999


i am doing some bit operations, and dont understand the following:

>>> ~ 1
-2

huh???? i would have thought that bitwise invert of 1 would be

0001 --> 1110 = 13 (base 10)

what marble am i missing?

les schaffer




More information about the Python-list mailing list