TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Python: Acceptance of Pattern Matching – PEP 634

48 点作者 potomak超过 4 年前

3 条评论

JNRowe超过 4 年前
Direct links to the PEPs themselves, to perhaps save others a little time.<p>Accepted:<p><i>Specification</i> <a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0634&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0634&#x2F;</a><p><i>Motivation and Rationale</i> <a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0635&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0635&#x2F;</a><p><i>Tutorial</i> <a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0636&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0636&#x2F;</a><p>Rejected:<p><i>Unused variable syntax</i> <a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0640&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0640&#x2F;</a><p><i>Explicit Pattern Syntax for Structural Pattern Matching</i> <a href="https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0642&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.python.org&#x2F;dev&#x2F;peps&#x2F;pep-0642&#x2F;</a>
pansa2超过 4 年前
It&#x27;s interesting that pattern matching has been accepted despite a poll showing a majority (65%) of core developers opposed to this particular proposal, and a plurality (44%) opposed to pattern matching altogether.<p><a href="https:&#x2F;&#x2F;discuss.python.org&#x2F;t&#x2F;gauging-sentiment-on-pattern-matching&#x2F;5770" rel="nofollow">https:&#x2F;&#x2F;discuss.python.org&#x2F;t&#x2F;gauging-sentiment-on-pattern-ma...</a>
评论 #26076667 未加载
评论 #26087221 未加载
评论 #26076528 未加载
pansa2超过 4 年前
Is it still the case that these two pieces of code have different behaviour?<p><pre><code> match status: case 404: return &quot;Not found&quot; not_found = 404 match status: case not_found: return &quot;Not found&quot; </code></pre> IIRC in an earlier proposal, the former would check for equality (`status == 404`) and the latter would perform an assignment (`not_found = status`).
评论 #26076964 未加载
评论 #26081990 未加载
评论 #26113728 未加载