Author martin.horcicka
Recipients martin.horcicka
Date 2007-09-26.20:34:54
SpamBayes Score 0.0637749
Marked as misclassified No
Message-id <>
Many people expect the match object from the re module to always be
true. They use it this way:

    if regexp.match(string): do_something()

Some people do not expect it and use it differently:

    if regexp.match(string) is not None: do_something()

Even in the standard library both ways are used. The first way is
simpler and nicer and thus better, in my opinion.

Current implementation of the match object (implemented as
_sre.SRE_Match object in Modules/_sre.c) seems to guarantee the trueness
(someone should check it) but in fact, there is no guarantee described
in the documentation.
Date User Action Args
2007-09-26 20:34:55martin.horcickasetspambayes_score: 0.0637749 -> 0.0637749
recipients: + martin.horcicka
2007-09-26 20:34:54martin.horcickasetspambayes_score: 0.0637749 -> 0.0637749
messageid: <>
2007-09-26 20:34:54martin.horcickalinkissue1208 messages
2007-09-26 20:34:54martin.horcickacreate