xor operator?

jurgen.defurne at philips.com jurgen.defurne at philips.com
Mon Jan 29 07:02:30 EST 2001


I have indeed never met a language which had a boolean XOR (but some
have a binary XOR).

I did meet some cases where an action would be needed based upon
the exclusivity of two states, but I think it is better for the understanding
and maintenance of code when you say :

        if (not A and B) or (A and not B)

Jurgen




mwh21 at cam.ac.uk@SMTP at python.org on 26/01/2001 15:17:17
Sent by:	python-list-admin at python.org
To:	python-list at python.org@SMTP
cc:	 
Subject:	Re: xor operator?
Classification:	

Def P <def-p at usa.net> writes:

> I notice that there doesn't seem to be a boolean xor operator in
> Python. Does someone know the reasons behind this?

I suspect largely because C doesn't have one (do any reasonably
mainstream languages have one?  I can't think of any).  There was a
thread about this fairly recently that shouldn't be too hard to dig
up...

Cheers,
M.

--
  The ability to quote is a serviceable substitute for wit.
                                                -- W. Somerset Maugham
--
http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list