How to do this in Python...

Erik Max Francis max at
Fri Jan 24 04:22:36 CET 2003

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.

 Erik Max Francis / max at /
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ No man who needs a monument ever ought to have one.
\__/ Nathaniel Hawthorne
    Crank Dot Net /
 Cranks, crackpots, kooks, & loons on the Net.

More information about the Python-list mailing list