"is" and "=="

Erik Max Francis max at alcyone.com
Tue Mar 11 17:56:35 EST 2003


Terry Reedy wrote:

> That is one of the few uses, and is recommended over 'x == None'.  'x
> is True' would be except that 'x' and 'x is True' have the same
> logical value and thus the extra test is useless.  Similarly for 'not
> x' and 'x is False' (the former might also be faster).

In fact, the extra test is worse than useless, since it explicitly
excludes any true (or false) value other than the literal Boolean True
(or False).

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Experience is the name everyone gives to their mistakes.
\__/ Oscar Wilde
    Bosskey.net: Quake III Arena / http://www.bosskey.net/q3a/
 A personal guide to Quake III Arena.




More information about the Python-list mailing list