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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

McCarthy's amb operator in Python

2 点作者 coconutrandom超过 13 年前

1 comment

tmhedberg超过 13 年前
Isn't this essentially what list comprehensions are for? For instance, here's the Pythagorean triple example using a comprehension:<p><pre><code> [(a, b, c) for a in range(1, 11) for b in range(1, 11) for c in range(1, 11) if a ** 2 + b ** 2 == c ** 2] </code></pre> I understand that the semantics are slightly different, but I'd argue that the benefit of using a built-in, idiomatic Python construct instead of reinventing the wheel is pretty clear.<p>Or am I missing something?
评论 #2942135 未加载