➜

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 gregory.p.smith
Recipients gregory.p.smith
Date 2020-11-13.19:27:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
A well known anti-pattern in Python is use of re.match when you meant to use re.search.

re.fullmatch was added in 3.4 via https://bugs.python.org/issue16203 for similar reasons.

re.prefixmatch would be similar: we want the re.match behavior, but want the code to be obvious about its intent.  This documents the implicit ^ in the name.

The goal would be to allow linters to ultimately flag re.match as the anti-pattern when in 3.10+ mode.  Asking people to use re.prefixmatch or re.search instead.

This would help avoid bugs where people mean re.search but write re.match.

The implementation is trivial.

This is **not** a decision to deprecate the widely used in 25 years worth of code's re.match name.  That'd be painful and is unlikely to be worth doing without spreading it over a 8+ year timeline.
History
Date User Action Args
2020-11-13 19:27:03gregory.p.smithsetrecipients: + gregory.p.smith
2020-11-13 19:27:03gregory.p.smithsetmessageid: <[email protected]>
2020-11-13 19:27:03gregory.p.smithlinkissue42353 messages
2020-11-13 19:27:02gregory.p.smithcreate