[Python-ideas] XOR

Georg Brandl g.brandl at gmx.net
Tue Oct 27 23:46:31 CET 2009

Sturla Molden schrieb:
> Why does Python have a bitwise but not a logical xor operator?

How often do you need the xor operator?

> It's even weirder because boolean objects do have a __xor__ method.

The reason for that is that they inherit from integers.  That method is the
usual bitwise integer xor.

> Does Py3k have an xor keyword? (I am using 2.6 due to NumPy.)



Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

More information about the Python-ideas mailing list