[issue19251] bitwise ops for bytes of equal length

Serhiy Storchaka report at bugs.python.org
Sun Oct 13 22:21:16 CEST 2013


Serhiy Storchaka added the comment:

Use int's.

(int.from_bytes(a, 'big') ^ int.from_bytes(b, 'big')).to_bytes(len(a), 'big')

Adding & and | operations to bytes will be confused because bytes is a sequence and this will conflict with set operations.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19251>
_______________________________________


More information about the Python-bugs-list mailing list