Playing with Python
Jul 25, 2003
I don't know about you, but I need a "pet project" of sorts to learn a language properly. Reading books is an excellent way of learning the core principles of the it, but it's when I actually sit down and complete a considerable task, i.e. a program, that I really get the feel for the language.
As it turns out, I didn't have to play around with Python for an extensive period of time to notice that it's a very comfortable language to deal with.
My pet project was to produce a list of the citations on my site. Which is basically what Mark Pilgrim did some time ago to show off the possibilities of semantic markup.
As my very first Python project, I made a program that parses all my individual archives, produces a list of all citations, indexed by url and by citation, and that's in 70 lines of Python code. 70 lines.
Well, I already knew that Python code is very compact, that's obvious from just reading reference manuals and books. What I didn't know before I set out to do that pet project of mine, was that the code surprisingly often works on the first attempt at running it. And that's including my beginner mistakes of forgetting colons after for, if, class and function definitions.
I don't know how or why, but somehow I make less mistakes writing Python code than with other languages.
Comments
The discussion has been closed on this entry. Thanks to everybody who participated.