Does Python need an 'xor' operator?
Ken Peek
Ken.Peek at SpiritSongDesigns.comNOSPAM
Sat Apr 13 18:58:19 EDT 2002
"Martin v. Loewis" <martin at v.loewis.de> wrote in message
news:m3ofgn1avt.fsf at mira.informatik.hu-berlin.de...
| "Ken Peek" <Ken.Peek at SpiritSongDesigns.comNOSPAM> writes:
|
| > I think an 'xor' operator is needed. The 'xor'
| > operator means 'logical-exclusive-or', and
| > returns a 1 or 0.
|
| In Python 2.3, you will be able to write
|
| bool(a) ^ bool(b)
|
| Seems pretty clear to me.
|
| Regards,
| Martin
You didn't read my post well enough-- we can already _DO_
that with Python v2.2.x:
(not a) ^ (not b)
IMHO, neither the above, nor the future v2.3.x idiom:
bool(a) ^ bool(b)
is as clear as:
a xor b
...
Everyone_is_entitled_to_have_my_opinion'ly yours,
--Ken Peek
More information about the Python-list
mailing list