Skip to content

Soft deprecate re.match and re.Pattern.match in favour of prefixmatch #148100

@hugovk

Description

@hugovk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-regextype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions