[Python-ideas] String and bytes bitwise operations
storchaka at gmail.com
Thu May 17 08:49:02 EDT 2018
17.05.18 15:20, Steven D'Aprano пише:
> On Thu, May 17, 2018 at 02:14:10PM +0300, Serhiy Storchaka wrote:
>> 17.05.18 13:53, Ken Hilton пише:
>>> But it might be useful in some cases to (let's say) xor a string (or
>> The question is how common a need of these operations? If it is not
>> common enough, they are better be implemented as functions in a
>> third-party library.
> The real question is, what does it mean to XOR a text string?
The OP explained this meaning with a sample implementation.
>> Are you aware that this can raise a ValueError for some input strings?
>> For example for '\U00100000' and '\U00010000'.
> That works for me.
> py> ''.join(chr(ord(a) ^ ord(b)) for a, b in zip('\U00100000', '\U00100000'))
Try with '\U00100000' and '\U00010000', not with '\U00100000' and
More information about the Python-ideas