missing 'xor' Boolean operator

Hendrik van Rooyen mail at microcorp.co.za
Wed Jul 15 09:37:30 EDT 2009


"Steven D'Aprano" <steven at REMOVE.THIS.cy..e.com.au> wrote:

>Unfortunately, outside of boolean algebra and simulating electrical 
>circuits, I can't think of any use-cases for an xor operator. Do you have 
>any?

A bitwise xor is a poor man's comparator - if the result is binary zero,
the operands were equal, no matter what they represented.

Not much use in python, though.

- Hendrik







More information about the Python-list mailing list