3 ms·
"Also, 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 ot
by jemfinch 13y ago
"Also, 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. The other value might have a type (such as a container) that could be false in a boolean context!"
From PEP-8: http://legacy.python.org/dev/peps/pep-0008/ http://legacy.python.org/dev/peps/pep-0008/