Getting started with Python

Wednesday 23 May 2007

I was at the Boston Python Meetup tonight. It was, as always, an interesting mix of old hands and new people looking into Python as a language (and/or way of life). One question tonight was, “How should I get started with Python?”

The usual answer to this question covers book and sites that teach the language. There are plenty of them, go find one that resonates with you. Beyond learning the details of the language, though, here’s my advice:

The best way to get started is to find a problem that really interests you. Maybe it’s a tool that would be really helpful at work. Maybe it’s in a field in which you are an expert. Maybe it’s revisiting your high school science fair project. Whatever it is, it should be something you are excited about. Learning a new language can be difficult, so having a real drive for the problem at hand is good for getting you through the thorny parts.

I’ve found toy example and other people’s simple projects to be not that great for learning from, they run out of steam really quickly. I need a real problem at hand to solve.

If a project of your own isn’t on the tip of your fingertips, you can try joining an existing project. This can be a good way to get a supportive community who can help you. Here, my advice is to start small and humble. Find a project that interests you, and find out what help they need. Don’t try to take on too much.

Some people barge into a project announcing great ideas and grand plans, but it’s awfully hard to deliver on those promises. They also may not have a sense of the culture and history of the group. You may have big ambitions, but keep them to yourself at first. Ask what you can do, choose something small to accomplish, and get it done. Then you can find a bigger thing to do.

The great thing about getting started with a language like Python is there is a very strong community. The same goes for Ruby and Perl. These are languages created by open-source amateurs for use by open-source amateurs. Everyone involved is there because they want to be. Other languages (C++, Java, etc) have their proponents, and lots of enthusiastic followers, but they also have their share of people who fell into it, or were required to use it, or believed the marketing of some company that had a vested interest in it.

So pick a community, pick a project, and get started. Python is very welcoming.

Comments

[gravatar]
christopher baus 10:06 PM on 23 May 2007

Totally agree. Solving a real problem is about the only I learn anything.

[gravatar]
Ian Bicking 10:33 PM on 23 May 2007

I think screen scraping and other web client problems are a nice place to start. I wish our tools were a bit nicer, but they are at least acceptable. Unlike a web application, you don't have to worry about hosting or anything like that -- you use it, if it works for you it's fine (maybe have it generate static HTML if that's helpful). And there's usually interesting stuff to play around with.

[gravatar]
Bill Mill 11:58 PM on 23 May 2007

I got my start when, just for kicks, I wrote an SMTP client for a class project in both Python and in C. Even using raw sockets, it was far easier to both learn python and code the client than it was just to write it in C.

Then, I wrote a program to parse ID3 tags and rename my mp3 files to my specifications. This time, I started in Java, got frustrated, went back to python, and have never looked back.

[gravatar]
Nate Finch 11:04 AM on 24 May 2007

I'd used Python a tiny bit with Ned at Kubi (for Cog), but never really wrote anything in it. A little while ago I started a big (big!) side project with a couple friends and needed a LAMP friendly language. Python was my first choice. Boy is it a challenge learning a new language and new infrastructure all at once.... but python is great. In the meantime, I wrote a handy script for my girlfriend that scrapes a website for info so she can do in a half a second what otherwises takes about 5 minutes. Between the two, I have a good start on Pythony goodness, but still have a ton to learn.

I got Python in a Nutshell as my first Python book, and I think it's a spectacular introduction to the language for someone with plenty of knowledge in other languages. There's enough introductory material in the first few chapters to tell you how the language work, and then the rest is an easy to use reference. Exactly what a beginning programmer needs.

[gravatar]
Joe Grossberg 11:52 AM on 24 May 2007

Ian:

That's exactly what I did for my own first personal Python projects. I found sites that didn't have RSS feeds (paulgraham.com, some comics) and generated my own.

I even used Test-Driven Development.

And then I refactored a lot.

Itch scratched, stuff learned.

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.