Names changed to protect the guilty

John J. Lee jjl at pobox.com
Mon Oct 9 17:01:58 EDT 2006


Ben Finney <bignose+hates-spam at benfinney.id.au> writes:

> jjl at pobox.com (John J. Lee) writes:
> 
> > aahz at pythoncraft.com (Aahz) writes:
> > >     if schema.elements.has_key(key) is False:
> >
> > 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.
> 
> Apparently a reason unrelated to dict.has_key, which is documented as
> returning only True or False, never None.

Yes, that's true, I didn't really take in this particular example,
just the use of "is <bool constant>".  That's not the way it was used
in docutils, though (do I mean docutils?).


John



More information about the Python-list mailing list