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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Writing clean, testable, high quality code in Python

175 点作者 m3mb3r超过 14 年前

6 条评论

barnaby超过 14 年前
Nice, this goes into some ground not covered in other python testing discussions. Great code examples. :-) These are the kinds of articles I come to hacker news to find.
评论 #2023357 未加载
评论 #2023530 未加载
评论 #2023330 未加载
grovulent超过 14 年前
This is a really helpful article for me. I'm a programming newb and have been banging out ad hoc code for the last six months. Boy do I have some mega-functions. I've known enough to know that at some point this practice has to change, but I've been a bit stuck as to how to start making improvements. So I'm looking forward to working through this example.
评论 #2023654 未加载
hessenwolf超过 14 年前
I would like to be able to share this, amiably, with a few of my colleagues and bosses who are not programmers, as we recently had to judge a $half-million piece of software with 2 600 line cashflow functions and I was the only one complaining.<p>But, yeah, look, the article is 'fine', but not much more, and very unfortunately.<p>Does anybody know of a similar article re modularisation with a more transparent example, and a more detailed transition between hypothesis and conclusion? He just seems to say 'less complexity', ???, 'profit'.
评论 #2023870 未加载
评论 #2023847 未加载
deepu_256超过 14 年前
Write tests, run code-coverage and code-smells. While good advice, that's just saying what to do. Not how to do. You can as well remove the word Python from the title and the advice holds true in general.<p>What i would like to see :- what in python we can use that will help us write quality, concise code. Things like using list comprehensions, using magic methods, higher order functions(decorators...) and may be something else that i didn't knew.
评论 #2023837 未加载
qjz超过 14 年前
I use a similar commenting style, but in addition to the description, arguments and returns, I also list globals used (if any) and side effects (even if none). I find it very helpful to show if a function depends on or alters state.
bedroomfireflys超过 14 年前
IBM's just trying to get brownie-points with web developers because they know that they won't be around much longer.
评论 #2023715 未加载
评论 #2023984 未加载