missing 'xor' Boolean operator

Emile van Sebille emile at fenx.com
Thu Jul 16 17:59:22 EDT 2009


On 7/16/2009 1:29 PM Nobody said...
> On Wed, 15 Jul 2009 18:14:10 +0200, Hrvoje Niksic wrote:
> 
>>> If the question was "Why is there no 'or' operator ?", would "because
>>> A or B <=> not(not A and not B)" be a proper answer ?
>> Note that in Python A or B is in fact not equivalent to not(not A and
>> not B).
> 
> Ah, but it *is* "equivalent"; it isn't "identical", but that's not the
> point.
> 

I'm not sure I'd call it equivalent.  A or B returns either unaltered, 
and not(not A and not B) always returns a boolean.  The equivalent would 
be not(not( A or B )).

Emile




More information about the Python-list mailing list