The Python language tutorial is a gem

April 29, 2012

One of the things that my recent experience learning JavaScript has made me realize (or at least reminded me) is that the Python language tutorial is a gem. Specifically it's clearly a gem starting at section 3, An Informal Introduction to Python.

What the tutorial excels at is getting someone who already knows programming up to speed in Python very fast. It doesn't try to teach you everything (although it covers quite a lot) and it assumes that you can pick things up on the fly (eg, a certain amount of syntax only appears in the examples), but if you can keep up you can absorb a significant amount of Python in a few pages. Someone who really finishes the tutorial will have easily learned enough Python to do quite a lot of useful work. Oh, and the tutorial does all of this without glossing over complexities; the tutorial may not cover everything, but what it covers it covers accurately.

(The fastest way to get me to distrust any language introduction is to tell me something that I know is not true. I ran into several quick introductions to JavaScript that over-simplified its peculiar ===, for example.)

At a pragmatic level what the tutorial really is, where it's important, is that it's a great tool for turning general programmers into Python programmers; it makes it easy, almost effortless, to take a look in. If you have a not too large problem that you think Python might be the answer for, you can read the tutorial and know one way or another in an hour or two. In the process you'll have picked up enough to get a feel for the language and whether or not you particularly like it.

But pragmatism isn't everything. Beyond its usefulness for recruiting, the tutorial is simply a gem of teaching. Somehow it has managed to boil things down just right; it knows what to leave out, what to elide, and what to put into examples and let you follow along. If you look at it objectively the tutorial makes a an awful lot of courageous assumptions about what the reader can follow, but I firmly believe that it gets them right. Its boldness and willingness to assume intelligent interest on the reader's part is refreshing.

(Although I don't know the history of the tutorial, I salute the kind of authorial courage that I suspect it took to not make the tutorial slower, more verbose, and more timid. There's always an urge to put in an extended explanation just in case part of the audience didn't get it or didn't have the background you expected.)

Oh, and on a side note, one of the things that tutorial is also great for is quickly coming up to speed on major new Python features. I started on Python in the 1.5 era, and I'm pretty sure that I learned list comprehensions, generator expressions, and a few other things from reading new sections of the tutorial.

It vaguely boggles me that so few other languages seem to try to have any equivalent of the Python tutorial. In today's environment, many people who already know programming in general will be trying to pick up your language specifically; what they want is exactly this sort of quick tutorial to bring them up to speed. Yet I've barely seen any attempts in the various languages I've looked at over the years, even though it probably wouldn't be all that difficult to take the Python tutorial and rewrite the specific syntax details for your own language.

(This whole issue was brought to mind partly by not finding anything like this for JavaScript, even for the basic language. I found some crude, flawed attempts but none that I thought were half as good as the Python tutorial.)

Written on 29 April 2012.
« My two approaches to learning (programming) languages
Notes to myself about progressive JavaScript »

Page tools: View Source, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sun Apr 29 22:47:08 2012
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.