[Python-Dev] bitwise operations for bytes and bytearray (original) (raw)
Blake Griffith blake.a.griffith at gmail.com
Thu Jan 7 20:06:06 EST 2016
- Previous message (by thread): [Python-Dev] bitwise operations for bytes and bytearray
- Next message (by thread): [Python-Dev] bitwise operations for bytes and bytearray
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks for the quick responses y'all. I have something compiling on my branch, which is enough for me tonight.
I asked a question about this on stackoverflow a while ago, it wasn't very popular https://stackoverflow.com/questions/32658420/why-cant-you-xor-bytes-objects-in-python
Someone there pointed out this feature was suggested on the mailing list a while back (2006) https://mail.python.org/pipermail/python-dev/2006-March/061980.html
On Fri, Jan 8, 2016 at 1:12 AM, Andrew Barnert <abarnert at yahoo.com> wrote:
On Jan 7, 2016, at 15:57, Martin Panter <vadmium+py at gmail.com> wrote: > >> On 7 January 2016 at 22:26, Blake Griffith <blake.a.griffith at gmail.com> wrote: >> I'm interested in adding the functionality to do something like: >> >>>>> b'a' ^ b'b' >> b'\x03' >> >> >> Instead of the good ol' TypeError. >> >> I think both bytes and bytearray should support all the bitwise operations. > > There is a bug open about adding this kind of functionality: > <https://bugs.python.org/issue19251>.
And it's in the needs patch stage, which makes it perfect for the OP: in addition to learning how to hack on builtin types, he can also learn the other parts of the dev process. (Even if the bug is eventually rejected, as seems likely given that it sat around for three years with no compelling use case and then Guido added a "very skeptical" comment.) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160108/37631f75/attachment-0001.html>
- Previous message (by thread): [Python-Dev] bitwise operations for bytes and bytearray
- Next message (by thread): [Python-Dev] bitwise operations for bytes and bytearray
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]