Resources for Learning Python

We can do this the hard way, or the easy way...

I am often asked my opinion on how to get starting with programming, and usually with Python in particular. I usually outline three different routes that must be taken: learning how to work with Python, learning best practises for Python, and reading lots of good code from others.

How Does Python Work?

The first stage, is learning about Python the language. There are several ways to approach this depending on your previous experience:

For those who have never programmed before, Learn Python The Hard Way forces a very practical approach to learning the program (with Python). I tend to think that it would have worked very well for me since it tailors to how I tend to learn best, and hope that sort of approch would work for others as well.

For those with a moderate amount of programming experience (not even an interpreted scripting language like Python), Mark Pilgrim's Dive Into Python gives a friendly overview from the very basics to very deep topics.

For those who have mastered every language that isn't Python, The Python Language Reference followed by The Python Standard Library will tell you everything there is to know.

Finally, a test. The interactive Python Koans project teaches and tests you via a suite of 38 "lessons" comprised of 304 "koans" (as of September 2014). It doesn't teach you every last little thing about the language, but gets you 95% of the way and is a joy to work on.

Python Best Practises

While you are learning how Python works, you also need to learn the best ways to use it. While there should be one-- and preferably only one --obvious way to do it, the "obvious" way isn't always self-discoverable.

I have found Kenneth Reitz's The Hitchhiker's Guide to Python to be a fantastic read on current best practises, Python idioms, and project management.

Python Examples

The next best thing after writing lots of code (you are doing that, right?), is reading lots of code. Some of my recent favourites are:

  • building a web framework, via Flask;
  • humanizing HTTP requests, via Requests;
  • and use of the C-API to implement coroutines, via Greenlet.
Posted . Categories: .