[issue42353] Proposal: re.prefixmatch method (alias for re.match)
Gregory P. Smith
report at bugs.python.org
Sat Nov 14 13:22:46 EST 2020
Gregory P. Smith <greg at krypto.org> added the comment:
My point is that re.match is a common bug when people really want re.search.
re.prefixmatch makes it explicit and non-confusing and thus unlikely to be used wrong or misunderstood when read or reviewed.
The term "match" when talking about regular expressions is not normally meant to imply any anchoring as anchors can be expressed within the regex. Python is relatively unique in bothering to have different methods for a prefix match and an anywhere match. (We'd have been better off without a match method entirely, only having search - too late now)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42353>
_______________________________________
More information about the Python-bugs-list
mailing list