comparing booleans

zde spamtrap at bigfoot.com
Fri Jan 30 09:51:45 CET 2004


Erik Max Francis wrote:
 
> 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.

Unfortunately, this mis-feature works for other operators as well:
Since 'in' operator usually has higher precedence than '==', it's
pretty annoying to see:

Python 2.3.3 (#2, Jan  4 2004, 12:24:16) 
>>> 'a' in 'abc'
True
>>> 'a' in 'abc' == True
False
>>> 




More information about the Python-list mailing list