missing 'xor' Boolean operator

Mark Dickinson dickinsm at gmail.com
Tue Jul 14 15:52:34 EDT 2009

On Jul 14, 8:43 pm, Chris Rebert <c... at rebertia.com> wrote:
> On Tue, Jul 14, 2009 at 11:47 AM, Mark Dickinson<dicki... at gmail.com> wrote:
> > (1) It's easy to emulate xor:  'x xor y' <-> bool(x) != bool(y)
> Using the xor bitwise operator is also an option:
> bool(x) ^ bool(y)

Good point.  For some reason I expected bitwise operations on bools to
return ints rather than bools.  Now I know better. :-)



More information about the Python-list mailing list