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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Code boilerplate: Is it always bad? A case study between Python and Go

17 点作者 Spiritus大约 8 年前

2 条评论

makk大约 8 年前
The author&#x27;s Python example is a straw man. You can write generator expressions that way... if you hate yourself and all the people who will have to deal with your code.<p>The Go alternative that&#x27;s provided, if that&#x27;s one&#x27;s stylistic preference, is just as easily implemented in Python as it is in Go.<p>To my eyes neither the Go nor the Python implementations in the article are beautiful.<p>In any case, despite his bagging of Python, it seems like the author would agree with the Zen of Python:<p>Flat is better than nested. Sparse is better than dense. Readability counts.
seunosewa大约 8 年前
&quot;My claim is: For non-trivial projects, proportional code is not cumulatively more lines than disproportional code.&quot;<p>We can test it by comparing the lines of code in non-trivial Python programs on GitHub with equivalent programs written in Go.