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.

Writing clean, testable, high quality code in Python

175 pointsby m3mb3rover 14 years ago

6 comments

barnabyover 14 years ago
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 未加载
grovulentover 14 years ago
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 未加载
hessenwolfover 14 years ago
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_256over 14 years ago
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 未加载
qjzover 14 years ago
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.
bedroomfireflysover 14 years ago
IBM's just trying to get brownie-points with web developers because they know that they won't be around much longer.
评论 #2023715 未加载
评论 #2023984 未加载