TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Python: Acceptance of Pattern Matching – PEP 634

48 pointsby potomakover 4 years ago

3 comments

JNRoweover 4 years ago
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>
pansa2over 4 years ago
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 未加载
pansa2over 4 years ago
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 未加载