Newbie -- bitwise shifts

gbblob gerald.britton at allstream.com
Wed Feb 4 16:24:00 EST 2004


Can someone please explain to me why left shits are equivalent to
multiplication and right shifts equivalent to devision?  This seems
backwards to me.

e.g.

15 is binary 1111
if I shift this left 2 bits I get 11

however in Python 15<<2 = 60 ?!



More information about the Python-list mailing list