August 8, 2008
I took a 3-hour tutorial on basic Python at OSCON this year, partly to see what it was like from the perspective of a neophyte because I’ve been teaching a lot of newbies to code lately. Plus I just like Python, potentially I could come to love Python… which doesn’t of course mean that I don’t have some issues and puzzlements about that community.
I have to say I can’t approve of the way Python is taught, which is invariably feature-based rather than task-based. Our instructor did the typical Python thing, which is to start babbling on about lists-tuples-dicts, demonstrate slices, move on to closures, deliver a little lecture on OOP, and finally try to explain the whole Python 3 thing. That’s all very very cool, but let me put it this way: think of a case from your entire career in which you needed to use a tuple as the key to a dictionary item. Ops Boy came up with one (geocoding), but that’s not exactly a daily task for most programmers. I happen to believe that the vast majority of humans — particularly women — learn faster if given concrete, task-based instruction with a goodly amount of repetition using realistic examples from meaningful domains.
I think this focus on “cool rather than useful features of Python” generally comes out of what I see as their biggest weakness as a community: lack of focus, exacerbated by small size. Check out the Python.org statement of what Python is good at: everything from humongous web frameworks to scientific programming to games to new ideas in sockets. PHP, in contrast, knew from Day One what it wanted to be the best at when it grew up, and generally PHP teaching tends to be quite concrete and task-based. From what I’ve seen of Perl culture, it’s even more about getting shit done without regard for adorable flourishes. I get the feeling that there’s an awfully large body of knowledge that 100% of PHP users will want to know; but for Python there might be 5 disparate topics, each of which is beloved by 20% of the community. It’s hard to grow the entire team like that.
At this juncture you probably want to point out that Java has a universal focus with seemingly more projects and libraries than there are grains of sand on the beach… but they are also probably the biggest community of all time, with massive corporate resources behind them. Pythons, if you’ll permit me a gross generalization albeit one based on personal experience, tend to be proud individualists who have difficulty accomodating the herdthink that is a necessary part of organizing resources at scale. Under those circumstances, it’s difficult to grow a community big enough to be great at so many things; and it’s disastrous to follow Java’s path towards imperial overstretch. I’ve also come to believe that PHP was lucky in never having a single Benevolent Dictator type, but instead having multiple leaders who were good at different things and had different interests.
It’s possible that deep down Pythons don’t care about being popular — and that would be cool if it were true. But it would be a shame if they actually want to be understood and loved, and just can’t explain themselves to newbies. I can only reiterate that task-based rather than feature-based thinking is the way to go. If you can’t explain the 10 things that everyone will want to do with Python rather than another programming language, and the 10 questions everyone will have about Python, then you probably have a bigger problem than just a lack of publicity.