<div dir="ltr">Hi!<br><br>I'm interested in adding the functionality to do something like:<br><br><div><font face="monospace, monospace">>>>  b'a' ^ b'b'</font></div><div><font face="monospace, monospace">b'\x03'</font></div><div><font face="monospace, monospace"><br></font></div><div><br></div><div><font face="arial, helvetica, sans-serif">Instead of the good ol' TypeError.</font></div><div><font face="arial, helvetica, sans-serif"><br>I think both bytes and bytearray should support all the bitwise operations.<br><br>I've never hacked on cpython before. I'm starting by just trying to add xor to bytearray. I have a ByteArray_Xor function that I think should do this here <a href="https://github.com/cowlicks/cpython/commit/d6dddb11cdb33032b39dcb9dfdaa7b10d4377b5f">https://github.com/cowlicks/cpython/commit/d6dddb11cdb33032b39dcb9dfdaa7b10d4377b5f</a></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">But I'm not sure how to hook this in to the rest of cypython. I tried adding it where </font><font face="monospace, monospace">bytearray_as_sequence </font><font face="arial, helvetica, sans-serif">is declared in this bytearrayobject.c file. But that gave me compiler warnings and broke things.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">So now that I have this ByteArray_Xor function, how do I make it be bytearray.__xor___?</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thanks!</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Blake</font></div></div>