Re: [Python-ideas] String and bytes bitwise operations

May 18, 2018
8:58 p.m.
On Fri, 18 May 2018 13:49:58 -0300, Facundo Batista wrote:
Once you think as the whole sequence of bytes as a sequence of bits (eight times longer, of course), all questions are easly answered, see below...
I had never considered this before, but it seems very interesting. Essentially that would make bytes1 ^ bytes2 be equivalent to (int.from_bytes(bytes1, sys.byteorder) ^ int.from_bytes(bytes2, sys.byteorder)).to_bytes(max(len(bytes1), len(bytes2)), sys.byteorder) rather than bytes(a ^ b for a, b in zip(bytes1, bytes2)) I like that idea more than my original elementwise idea. Thinking, Ken Hilton;
2496
Age (days ago)
2496
Last active (days ago)
0 comments
1 participants
participants (1)
-
Ken Hilton