[Python-ideas] String and bytes bitwise operations

Richard Damon Richard at Damon-Family.org
Fri May 18 12:54:20 EDT 2018

On 5/18/18 12:32 PM, Chris Barker via Python-ideas wrote:
> actually, bytes are, well, bytes ;-) -- that is, 8 bits. But the point
> is that "bitwise" operations make all the sense in the world for
> bytes, but not for unicode text -- did anyone have a use case for
> bitwise operation on unicode strings? I can't imagine one, even if you
> could agree on a definition...
The one case I could think of is a very crude form of encryption.
Probably most makes sense if you assume the string is really just ASCII.
Not sure if that is a good enough case to be worth adding it, as often
you special case some characters (like control characters) to avoid
messing things up too much for display.

Richard Damon

More information about the Python-ideas mailing list