xor operator

Chris Angelico rosuav at gmail.com
Mon Nov 13 17:01:15 EST 2023


On Tue, 14 Nov 2023 at 08:57, Axel Reichert via Python-list
<python-list at python.org> wrote:
>
> Barry <barry at barrys-emacs.org> writes:
>
> > I do not understand how xor(iterator) works.
> > I thought xor takes exactly 2 args.
>
> See
>
>   https://mathworld.wolfram.com/XOR.html
>
> for some background (I was not aware of any generalizations for more
> than 2 arguments either).
>

Generalization to more arguments usually means calculating parity -
that is, it tells you whether you have an odd or even number of true
results. Which means that short-circuiting is nonsensical.

ChrisA


More information about the Python-list mailing list