

Ask HN: Really great Python code - jobeirne

So I've got an intermediate fluency with Python, but it's time for me to start writing some serious software and I'd like to get a feel for how things are Actually Done in Python.<p>Sifting through books is fun and all, but it seems to me that the most expedient route to cutting my teeth would be to dive into an existing code-base.<p>Is there a well written, publicly accessible Python project somewhere that can be perused to the end of getting an advanced feel for the language?
======
mace
The Python standard has some pure Python modules may be worth looking at. Doug
Hellmann's Python Module of the Week,
<http://www.doughellmann.com/PyMOTW/contents.html>, is good place to start.

I'd recommend looking at code that interests you. It will make reading the
code more interesting and perhaps more useful. Here are some popular projects
arrange by interest:

    
    
      Web framework: Django, Pylons
      TCP/IP networking: the official Bittorrent client, Mercurial, Tornado
      Database: SQLAlchemy, SQLObject
    

Past HN submissions are generally a good place to find interesting projects
too: <http://searchyc.com/submissions/python?sort=by_points>

------
d0mine
* How to Write a Spelling Corrector <http://norvig.com/spell-correct.html>

* Case Study: Metaclass Hacking in fetchmailconf <http://catb.org/esr/writings/taoup/html/ch09s01.html>

~~~
icey
All of Peter Norvig's Python code is fun to read.

------
yan
django is a very tidy and pythonic code base. Ditto for twisted, but twisted
might be more complicated than what you're trying to do (edit: or not). The
recent Tornado server is of a an approachable size and from the look of it,
very well engineered.

~~~
swolchok
Doesn't Twisted have a lot of crusty, poorly-documented parts? I remember
seeing a lot of old-style classes in Twisted Words.

------
kakooljay
There's tons of Python examples on Toby Segaran's blog:
<http://blog.kiwitobes.com>

I know you've read some Python books, but you might want to check out
Segaran's books too. The examples in Programming Collective Intelligence
[<http://oreilly.com/catalog/9780596529321>] are all Python too I think..

~~~
plinkplonk
"The examples in Programming Collective Intelligence are all Python too I
think.."

The code in PCI was terrible, very unpythonic code the last time I looked at
it.Not "really great" , which is what OP asked for.

Maybe someone has done a rewrite, but otherwise I'd be very careful using the
PCI code as an exemplar.

------
CyberFonic
I have gleaned many good ideas from the python libraries that are shipped with
the standard CPython distribution. I found the implementation of the various
TCP, HTTP, etc server classes very interesting. Learnt quite a bit by reading
the Tkinter support stuff.

