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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: Good python code for code reading

62 点作者 btw0超过 16 年前
Reading good python code must be an enjoyable learning experience, any suggestion?

13 条评论

jnoller超过 16 年前
I would definitely recommend sync'ing the python subversion tree and picking a few modules and reading through them. Doing so taught me some of the less obvious things within the language, and also taught me a lot about the various dunder (__foo__) methods for objects.<p>Additionally, I'd recommend reading through the PEP documents (<a href="http://python.org/dev/peps/" rel="nofollow">http://python.org/dev/peps/</a>) - there's a lot of great examples and rationales contained in those.<p>Finally, Doug hellmann has done an excellent job with his Python Module of the Week series (<a href="http://www.doughellmann.com/PyMOTW/" rel="nofollow">http://www.doughellmann.com/PyMOTW/</a>) and a new project "The hazel tree" (<a href="http://www.thehazeltree.org/" rel="nofollow">http://www.thehazeltree.org/</a>) is doing a great job at compiling the various examples, docs/etc together in one place.
评论 #327845 未加载
icey超过 16 年前
It's an essay that contains code, but this is one of my all time favorites:<p>Peter Norvig writes a spelling corrector in 21 lines of Python: <a href="http://norvig.com/spell-correct.html" rel="nofollow">http://norvig.com/spell-correct.html</a>
评论 #328223 未加载
kilowatt超过 16 年前
I learned quite a bit from web.py (<a href="http://github.com/webpy/webpy/tree/master" rel="nofollow">http://github.com/webpy/webpy/tree/master</a>). It's small enough to be fun to poke through, but has more than enough "advanced" Python tricks to be worth your while.
pogos超过 16 年前
BitTorrent <a href="http://download.bittorrent.com/dl/" rel="nofollow">http://download.bittorrent.com/dl/</a>
评论 #327799 未加载
评论 #328197 未加载
mamama超过 16 年前
The Cookbook (Amazon it, I'm too sleepy to link) contains examples of idiomatic code that you should use.
评论 #328916 未加载
pistoriusp超过 16 年前
I've always found Django to be a very clean code base.
bayareaguy超过 16 年前
Python ships with plenty of good python code. Just take your time and read through the Lib directory of your standard python distribution.<p><a href="http://svn.python.org/view/python/trunk/Lib" rel="nofollow">http://svn.python.org/view/python/trunk/Lib</a>
olefoo超过 16 年前
Mailman <a href="http://list.org/" rel="nofollow">http://list.org/</a><p>Things you should be looking at are queues and error handling in an asynchronous message passing architecture.<p>Also you'll learn that not every web application needs an SQL database for persistence.
alecco超过 16 年前
For performance and algorithms the implementations at <a href="http://shootout.alioth.debian.org/u32q/python.php" rel="nofollow">http://shootout.alioth.debian.org/u32q/python.php</a> and pay attention to the different benchmarks.<p>Also all RPython code coming from pypy, sometimes shown in <a href="http://morepypy.blogspot.com/" rel="nofollow">http://morepypy.blogspot.com/</a><p>They are reimplementing all the C modules and doing a great job. The new implementations are of course closer to current best practices in python.<p>Enjoy.
llimllib超过 16 年前
pybloxsom is a nice project to hack on; you can read and understand the whole of the code in a day, and it illustrates the "request handler with filters" design pattern very nicely. <a href="http://pyblosxom.sourceforge.net/" rel="nofollow">http://pyblosxom.sourceforge.net/</a>
stuartcw超过 16 年前
I enjoyed reading the code from "Hacking RSS and Atom" by Leslie M. Orchard (ISBN: 978-0-7645-9758-9). There's a lot more to it than just RSS related code and if you read the book you get the explanation too.
nirs超过 16 年前
twisted is very clean and readable.
intellectronica超过 16 年前
The Zope3 codebase.