[OT] Bit twiddling homework
ben.lists at bsb.me.uk
Fri Jul 20 07:38:03 EDT 2018
Brian Oney <brian.j.oney at googlemail.com> writes:
> On Fri, 2018-07-20 at 06:37 +0000, Steven D'Aprano wrote:
>> On Fri, 20 Jul 2018 08:25:04 +0200, Brian Oney via Python-list wrote:
>> > PS: Can I twiddle bits in Python?
>> These operators work on ints:
>> bitwise AND: &
>> bitwise OR: |
>> bitwise XOR: ^
> That's right I had forgotten about that.
There's also ~ for bitwise negation. Rather than explain what this
means in a language with an unbounded integer type, you might like to
experiment, er, a bit. (Excuse the pun.)
More information about the Python-list