Archive for April, 2012

Teaching myself Python in N easy lessons…. – Part 1

Friday, April 6th, 2012

Eric Raymond put out a call to all developers a while back, to work with him on what could become the next generation of ‘software forge’ – that combination of code repository, mailing list and/or wiki, and bug-tracking system that is the locus of a distributed, open-source, software development project.  I said to myself, “Well, here may well be one of the last opportunities I have to prove my chops as a hacker.  I better get on board with this.”

So I signed up for the mailing list for the project.  And further said, “Now I guess I gotta learn Python.”  Now almost 25 years ago I had taught myself Perl, and it wasn’t too tough a deal. So I figured that this wouldn’t be any worse, although I’m a quarter century older and cruftier, and I didn’t have a ‘work project’ as my driver.  And this is how things sat for almost five months.

But something this week kicked me in the metaphorical seat of the pants.  On my way home from work one evening, I stopped by our local big-box book store and dropped almost a benjamin and a half on some books.

I finally got serious the afternoon of Thursday the 5th by reading “Learning Python” by Mark Lutz (the O’Reilly rat book), starting at page one.  (Cue the Von Trapp family – “Let’s start at the very beginning, a very good place to start….”)  I opened a shell window and typed “python” to play along with the examples in the text.  By page 91, less than two hours later, I was seriously impressed.  D@mn!  Built-in comprehensive documentation with dir() and help(); standard libraries for OS interface (abstracting the common abilities for Windows, Macintosh, and *nix); lists of mixed types, with methods like .remove (by matching value), .sort, and .map already ginned up for me; list comprehension – but wait, there’s more!

This is going to be fun.  Inner programming geek goes “RAWR!” on savoring the fat-free, meaty texture of the language.  Why didn’t I do this years ago??

(You may now insert your obligatory diss of obsolete programmers, citing old dogs and new tricks  ;-}  )