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 matthew.suozzo
Recipients ezio.melotti, gregory.p.smith, matthew.suozzo, mrabarnett, serhiy.storchaka
Date 2020-11-15.00:27:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605400053.8.0.209521041473.issue42353@roundup.psfhosted.org>
In-reply-to
Content
> It just won't work unless you add explicit ".*" or ".*?" at the start of the pattern

But think of when regexes are used for validating input. Getting it to "just work" may be over-permissive validation that only actually checks the beginning of the input. They're one missed test case away from a crash or, worse, a security issue.

This proposed name change would help make the function behavior obvious at the callsite. In the validator example, calling "prefixmatch" would stand out as wrong to even the most oblivious, documentation-averse user.

> My point is that re.match is a common bug when people really want re.search.

While I think better distinguishing the interfaces is a nice-to-have for usability, I think it has more absolute benefit to correctness. Again, confusion around the semantics of "match" were the motivation for adding "fullmatch" in the first place but that change only went so far to address the problem: It's still too easy to misuse the existing "match" interface and it's not realistic to remove it from the language. A new name would eliminate this class of error at a very low cost.
History
Date User Action Args
2020-11-15 00:27:33matthew.suozzosetrecipients: + matthew.suozzo, gregory.p.smith, ezio.melotti, mrabarnett, serhiy.storchaka
2020-11-15 00:27:33matthew.suozzosetmessageid: <1605400053.8.0.209521041473.issue42353@roundup.psfhosted.org>
2020-11-15 00:27:33matthew.suozzolinkissue42353 messages
2020-11-15 00:27:33matthew.suozzocreate