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.

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

4 pointsby jemeshsuover 13 years ago

1 comment

thristianover 13 years ago
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 未加载