hiw3c AI 日报
Simon Willison 网页快照

温和反对的re.match()

原文标题 · Soft-deprecating re.match()

软弃用re.match()Python有一个软弃用的概念,其中API被标记为“不应再用于编写新代码”,并且没有任何承诺/威胁将来删除它们。Python 3.15发布经理Hugo van Kemenade描述了在即将到来的3.15版本中,古老但令人深感困惑的re.match()函数如何被软弃用。现在它有更清晰的替代名称re.prefixmatch()-反映了它如何锚定在字符串的开头,但不是结尾。大多

来源:Simon Willison · simonwillison.net

正文为英文,可一键机器翻译(仅首次需要等待)

Simon Willison’s Weblog

Soft-deprecating re.match() ( via ) 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.

Recent articles

OpenAI agents attacked RubyGems back in May - 12th September 2026

Some thoughts on the Navier–Stokes Millennium Prize Problem - 8th September 2026

The Pelican comparison grid for Astra is pretty interesting - 4th September 2026

This is a link post by Simon Willison, posted on 11th September 2026 .

Monthly briefing

Sponsor me for $10/month and get a curated email digest of the month's most important LLM developments.