Day: October 8, 2008

Development

Learning Python

I was asked today “How do I learn python?” (I’m not making this up, that is a direct quote lifted right out of the chat log!)

Of course my first response was “start at python.org” (as it would be.) That is all well and good, but I started thinking about what specific things helped me? So, here are some specifics that might work well for you if, like me, you learn about half and half from reading (theory) and doing (practice.)

The first step, of course, is to download Python. You don’t need a fancy IDE to develop in Python, although if you have one you are comfortable with and use all the time, chances are that it has a Python plugin. (I know Eclipse does, and I believe NetBeans does, and jEdit has a Python client plugin that lets you run Python code right in the editor.) If you don’t want to muck about with an IDE, though, Python comes with it’s own lightweight editor, IDLE. Open it up, play around a bit.

Ok, so you’re looking at IDLE thinking “well, there isn’t much here is there?” You’re right – time for step two. Head over to the beginner’s guide and go for it! There are tutorials aimed at people who are new to Python and to programming in general, and people who are new to Python but not to programming. There is even a list of Python courses you can buy, and a fairly large list of introductory Python books for those who learn best that way. There isn’t much I can say that isn’t there already. I kind of wish that I had started there myself. When I started playing with Python I skipped over this and went straight for the documentation and googling for specific answers, as I was trying to build a script that I needed at the time to parse 1 -2 GB log files. Java was too much tool for the job, I didn’t have access to a beefy enough Linux box to do it in Bash and PHP was doing nothing but running out of memory. It made for a bit of a rough entry into Python, but I kind of like that sort of challenge.

Which brings us to step three – build something. No, not a “Hello World” app, but something useful, in the immediate sense. Something that will make you smile, or make your life simpler, or even something that will allow you to tick off an item on your to-do list.

So what (besides the end of my rambling in parenthetical asides) are you waiting for?