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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

PEP 403: Proposal to Add Block-like Feature to Python

4 点作者 jemeshsu超过 13 年前

1 comment

thristian超过 13 年前
This is a thing that Python badly needs; especially for callback-heavy frameworks like Twisted. Unfortunately, the proposed syntax seems deeply un-Pythonic to me (to be fair, it's based on decorators whose syntax is also deeply un-Pythonic).<p>The most natural syntax I've ever seen proposed for this features is a trailing "where:" like this:<p><pre><code> x = ((p + q) / r, (p - q) / r) where: p = -b q = sqrt(b*b - 4*a*c) r = 2*a </code></pre> Unfortunately, that choice was nixed because of a fear that people would expect "where" to behave like SQL's "where". The second best English word would be "having", which fails the same test, and I can't really think of any more. :(
评论 #3107023 未加载