Drinking the Python Kool-Aid

Ok, ok, the title is hyperbole to draw your attention. I’m not quite ready yet to throw out Java, JavaScript, ActionScript and the other languages I write about on this blog. But what I can say, I’m charmed. My very first babysteps into the Python language have convinced me that it’s certainly worth pursuing.

I recently began studying Python for a few reasons, mostly because I thought it was about time I did. Both Python and Ruby have been on my “want to learn those” list for a long long time. And since “

Programming in Python 3” arrived on my doorstep last week, the decision was quickly made.

I’m not quite at xkcd levels yet, but I can certainly see glimpses of it already:

So what is so special about Python? Here are some of the things that I thought are interesting from the get-go:

  • If you grew up on C, moved to C++ and are now programming Java or C#, you’ll immediately notice the almost complete absence of punctuations. There are no semi colons, no curly braces, only a few colons here and there. It’s a lot of, almost, useless overhead you won’t have to worry about. The reason this works is …
  • Indentation is important. Code blocks (called “suites” in Python) are not surrounded by curly braces, but are indented the right amount. You’re free to choose the exact amount of indentation, so there is some flexibility, but no matter how you look at it, it certainly is strange at first.
  • When programming Python, you don’t define variables before you use them, you don’t declare their type and you can store objects of different types using the same variable. Variables, or object references are very flexible.
  • Yet, in spite of those 3 major differences with most traditional, static-typed languages most Python programs have a very familiar feeling. You feel right at home.

If I haven’t convinced you yet, Python is a language worth looking into, there are two more reasons why you might like to check it out. Zope and Django, both are top notch web frameworks that scream to be tested.

(image credit)