[issue19251] bitwise ops for bytes of equal length

Antoine Pitrou report at bugs.python.org
Thu Jan 7 19:19:13 EST 2016


Antoine Pitrou added the comment:

Two years ago I suggested this:

> Then I would prefer a view, using e.g. the buffer API, but without any copies.

... and of course Numpy already provides such an API:

>>> a, b = b"123", bytearray(b"abc")
>>> p = np.frombuffer(a, dtype=np.int8)
>>> q = np.frombuffer(b, dtype=np.int8)
>>> p ^ q
array([80, 80, 80], dtype=int8)
>>> b[0] = 64
>>> p ^ q
array([113,  80,  80], dtype=int8)

----------

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


More information about the Python-bugs-list mailing list