SyncAI.news, a Varaisys broadcasting
Soft-deprecating re.match()
SW

Simon Willison's Weblog

· 1 min read

AnalysisSimon Willison's Weblog

Soft-deprecating re.match()

Soft-deprecating re.match()

Python has a concept of soft deprecation, where APIs are marked as "should no longer be used to write new code" without any promise/threat to remove them in the future.

Python 3.15 release manager Hugo van Kemenade describes how in the upcoming 3.15 release soft deprecation has come for the venerable but deeply confusing re.match() function. It's now available with the much clearer alternative re.prefixmatch() name - reflecting how it anchors at the beginning of the string but not the end.

Most of the time you probably want re.search() (match this pattern anywhere in the string) or re.fullmatch() (match the entire string) instead.

Via Lobste.rs

Original source

This story was published by Simon Willison's Weblog. SyncAI.news shows a preview; the complete article is on the publisher's site.

Read the full story on simonwillison.net

Similar News