-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Soft deprecate re.match and re.Pattern.match in favour of prefixmatch #148100
Copy link
Copy link
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-regextype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
In #86519 (PR #31137), we added new re.prefixmatch and re.Pattern.prefixmatch as explicit names for re.match and re.Pattern.match, because it's really not obvious the shorter old names include a prefix anchor; you probably meant to use search (no anchors) or fullmatch (prefix and suffix anchors).
This is essentially a soft deprecation of the match names:
- It's okay to use the old name in old code, but prefer the new name in new code.
- We don't plan on removing the old name or emitting deprecation warnings.
Let's make this explicit.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-regextype-featureA feature request or enhancementA feature request or enhancement