Back to Daily Feed 
Python 3.15 Soft-Deprecates `re.match()` for Clarity
Worth Reading
Originally published on Simon Willison's Weblog by Simon Willison
View Original Article
Share this article:
Summary & Key Takeaways
- Python 3.15 is soft-deprecating the
re.match()function. - A new, clearer alternative,
re.prefixmatch(), has been introduced. re.prefixmatch()explicitly reflects that it anchors at the beginning of the string.- Developers are often better served by
re.search()orre.fullmatch(). - Soft deprecation means the API should not be used for new code but won't be removed soon.
Our Commentary
Oh, re.match(). The source of so much confusion for new Pythonistas. I've definitely seen my share of bugs caused by misunderstanding its behavior. Soft-deprecating it and introducing re.prefixmatch() is a fantastic move for developer experience. It's a small change, but it cleans up a long-standing footgun. This is how languages evolve gracefully.
View Original Article
Share this article: