How to do this in Python...

Aahz aahz at
Sun Jan 26 01:23:12 CET 2003

In article <3E30B17C.AE4AFE5C at>,
Erik Max Francis  <max at> wrote:
>Aahz wrote:
>> That seems a bit odd to me.  Why test against None, instead of simply
>> "if not match"?
>In this particular case, it doesn't much matter, since you're guaranteed
>any non-None match object will evaluate to true.  In general, though, if
>you know that a value might be "something" or None, an explicit test
>against None is warranted since that "something" may or may not evaluate
>as false itself.

That's precisely why you *shouldn't* test against None, unless you
specifically want to find out whether None was returned.
Aahz (aahz at           <*>

"Argue for your limitations, and sure enough they're yours."  --Richard Bach

More information about the Python-list mailing list