[newbie questions] if conditions - if isset - if empty

Chris Angelico rosuav at gmail.com
Sat Apr 14 19:03:50 EDT 2012


On Sun, Apr 15, 2012 at 9:00 AM, MRAB <python at mrabarnett.plus.com> wrote:
> re.match(...) returns either a match object or None. In a condition, a
> match object always evaluates as True and None always evaluates as
> False.

Yes, should have clarified that. It's a deliberate feature of the re
module that you can do this. Very handy.

ChrisA



More information about the Python-list mailing list