missing 'xor' Boolean operator

Miles Kaufmann milesck at umich.edu
Wed Jul 15 20:10:50 CEST 2009


On Jul 15, 2009, at 1:55 PM, Emile van Sebille wrote:
> On 7/15/2009 10:43 AM Jean-Michel Pichavant said...
>> Hrvoje Niksic wrote:
>> [snip]
>>> Note that in Python A or B is in fact not equivalent to not(not A  
>>> and
>>> not B).
>>>
>> Did I make twice the same obvious error ?
>
> No -- but in the not(not... example it doesn't short-circuit.

No; like 'A or B', 'not (not A and not B)' does in fact short-circuit  
if A is True.  (The 'and' condition does not have to evaluate the  
right operand when 'not A' is False.)

-Miles




More information about the Python-list mailing list