This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.horcicka
Recipients martin.horcicka
Date 2007-09-26.20:34:54
SpamBayes Score 0.063774854
Marked as misclassified No
Message-id <1190838894.61.0.476932713989.issue1208@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2007-09-26 20:34:55martin.horcickasetspambayes_score: 0.0637749 -> 0.063774854
recipients: + martin.horcicka
2007-09-26 20:34:54martin.horcickasetspambayes_score: 0.0637749 -> 0.0637749
messageid: <1190838894.61.0.476932713989.issue1208@psf.upfronthosting.co.za>
2007-09-26 20:34:54martin.horcickalinkissue1208 messages
2007-09-26 20:34:54martin.horcickacreate