[Python-ideas] Bitwise operations on bytes class
Ethan Furman
ethan at stoneleaf.us
Tue Jun 17 21:35:02 CEST 2014
On 06/16/2014 11:03 AM, Nathaniel McCallum wrote:
>
> I find myself, fairly often, needing to perform bitwise operations
> (rshift, lshift, and, or, xor) on arrays of bytes in python (both bytes
> and bytearray). I can't think of any other reasonable use for these
> operators. Is upstream Python interested in this kind of behavior by
> default? At the least, it would make many algorithms very easy to read
> and write.
I like the idea, but one question I have: when shifting, are the incoming bits set to 0 or 1? Why?
--
~Ethan~
More information about the Python-ideas
mailing list