random($foo)

Getting Started w/ Python

As you might have heard, Google AppEngine launched tonight, with Python as its initial (and only) programming language to interface with its services. I started switching over to Python (from Perl) a few years ago for general processing and daemon tasks (mostly for its sweet RPC bindings and its comprehensive, if still somewhat convoluted Unicode handling). Over time, as the libraries matured, I started moving more and more over - some things were long overdue, like a CPAN equivalent (pypi and EasyInstall have finally stepped up to the plate), but in some areas, like with cross-platform GUI toolkits, things like py2app/pyexe, or with libraries like Twisted, and SciPy, and Beautiful Soup, Python has long since blown past the competition.

Earlier this year, as I was wrapping up at Yahoo!, I knew I wanted a clean start, and after reviewing what was out there decided on switching to Python as my primary language and making a go of writing my new web apps in Django (deployment, performance, and decoupling being among the primary factors; less wankery in the development community was also a big part of it). I've been somewhat sidetracked by a slew of other projects, but so far it's been a good experience (and I hope to have some stuff to publish soon).

Anyway, all this is a very, very, long setup for a list of resources that may help those who are looking to get started working w/ Python. I'm still not as proficient as I'd like, so here are the references that I typically reach for:

  • PLEAC Python - PLEAC (Programming Language Examples Alike Cookbook) is a project that aims to port the Perl Cookbook to other languages. The Python port has been at 85% for years, but is invaluable when looking at basic constructs.
  • (the eff-bot guide to) The Standard Python Library - although a bit out of date and not comprehensive, it offers short and useful examples for most of the modules in Python. This is great because often times the official library docs while technically complete are also at times completely opaque. If I were to give any advice to people writing API docs, it would be to 1) have some simple real-world usage examples and to 2) allow user annotations (PHP was (and remains!) way ahead of the curve on this one. It's amazing how primitive the core language/library docs are.)
  • Dive Into Python - I waffle back and forth on how much I like Mark Pilgrim's book - it's oftentimes just short of useful and not organized so well (I'm still looking for a good language reference), but it also has really useful tidbits, like when I forget how to append the system import path
  • Python-by-example - this is a new one, and I haven't used it much (inline-search would do wonders for this) but I wholly approve of the intent: "This guide aims to show examples of use of all Python Library Reference functions, methods and classes."
  • Otherwise, I've found that doing a web search almost always turns up something on ASPN or on a mailing list somewhere.
  • Lastly, there are some interactive shells that are useful, specifically IPython. Reinteract is less of a tool that I use everyday and more of something that's damn cool. The same w/ Nodebox.

Of course, one of the biggest benefits of Python is how readable the source code is - it's definitely a big help for seeing how things works. Have any of your own favorite Python resources? Please post 'em up on the comments.

Getting up to speed on Django probably deserves its own post...

2008-04-07 23:03:19