[Tutor] Extracting bits from an array

Peter Otten __peter__ at web.de
Sat Apr 30 02:52:00 EDT 2016


Anish Kumar wrote:

> Right shifting is well defined in Python?

Yes. What might surprise someone used to fixed-size integers:

>>> -1 >> 1
-1

Any negative int will eventually end as -1:

>>> -1234 >> 10
-2
>>> -1234 >> 11
-1




More information about the Tutor mailing list