[Python-ideas] Bitwise operations on bytes class

Antoine Pitrou antoine at python.org
Tue Jun 17 22:37:29 CEST 2014


Le 17/06/2014 15:35, Ethan Furman a écrit :
>
> I like the idea, but one question I have:  when shifting, are the
> incoming bits set to 0 or 1?  Why?

By convention, 0. Historically, that's how CPUs do it.
(and also because it provides a quick way of multiplying / dividing by 2^N).

Regards

Antoine.




More information about the Python-ideas mailing list