I'm (somewhat) familiar with one's complement but I could use a refresher with regards to Python 2.7.
Why does ~0b1
print out to -2
?
I understand that a one's complement converts 1s to 0s and vice versa. I expected ~0b1
to print 0b0
or 0
.
Does print
automatically convert byte literals to some form of int
?
Any help is appreciated.