comparing booleans

Erik Max Francis max at alcyone.com
Thu Jan 29 21:05:18 EST 2004


Dang Griffith wrote:

> Not that I've never used this (cool) Python syntax in practice,
> but I thought it was worth mentioning that using != and ^ in
> boolean expressions does not always give the same result.  It does
> give the same result when there are only two operands.

This is because of operator chaining, which only exists a special case
for the relational operators (==, !=, <, <=, >, >=).  It's not actually
a difference in the truth table; it's because chaining operators behave
differently than other operators.

-- 
 __ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/  \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ The work will teach you how to do it.
    -- (an Estonian proverb)



More information about the Python-list mailing list