Names changed to protect the guilty

John J. Lee jjl at
Sun Oct 8 02:41:36 CEST 2006

aahz at (Aahz) writes:

> The following line of lightly munged code was found in a publicly
> available Python library...
>     if schema.elements.has_key(key) is False:
> Sorry, just had to vent.

I think I was reading the same code recently (epydoc?) and was also
momentarily horrified ;-) until I realized that it was quite
deliberately using three-valued logic (True, False, None) for some
presumably-sensible reason.  Since None is false, they had to use
"is".  So, given the need for three-valued logic, it's not as silly as
it looks.


More information about the Python-list mailing list