[Python-Dev] Style guide (PEP 8) updated

Guido van Rossum guido@python.org
Fri, 24 May 2002 14:28:22 -0400


> I'd add that checks for None should always be done using 'is (not)
> None'.

Yes.  Also, more subtle: beware of writing "if x" when you really mean
"if x is not None" -- e.g. when testing whether a variable or argument
that defaults to None was set to some other value.  This bit us
recently in a Zope project when x was a database object that happened
to respond to len(), unbeknownst to the author.  During testing the
database was never empty, so we didn't catch it until much later.

--Guido van Rossum (home page: http://www.python.org/~guido/)