Add "re.prefixmatch()", deprecate "re.match()"

We, as a language, need to stop looking towards the past and look towards what makes it possible to write more clearly understandable code without need for special domain knowledge and reference manuals. Thats why I put up that issue and PR implementing this in the first place.

We need re.prefixmatch.

re.match’s meaning is a real footgun problem that people continually trip over in Python.

Fixing it does not require getting rid of re.match. All we need is the trivial feature using the proper self-explanatory name (see PR) to provide a well lit path of the actually understandable name.

prefixmatch provides a clear way past the footgun. There is no requirement for all existing code to be updated and never will be. But complaining that it makes it worse, some theoretical problem of projects receiveing PRs to “fix” things that aren’t broken is focusing on yesterday instead of the future. Those are non-problems compared to enabling code to be more understandable.

24 Likes