Just another why Python rules article

I’ve been using python for a few years now. For me, it started as a replacement for Perl and blossomed from there. I loved it from the minute I dove in, but it wasn’t love at first sight for Eric Raymond.

Eric Raymond, open source advocate and author of The Cathedral & The Bazaar, describes how he came to Python and why it is now his favorite language on Python Success Stories

python-programming-the-way-guido-indented-itThe great part is how quickly you come up to speed with the syntax. It all just seems to make sense right away. In other languages such as Perl or C, I hate wasting time trying to figure out how to do what I want with the syntax. With python, I never seem to waste effort trying to fit my mental picture of a square peg into the languages round hole.

The language has no analog of the C and Perl brace syntax; instead, changes in indentation delimit statement groups. And, like most hackers on first realizing this fact, I recoiled in reflexive disgust… I skimmed through the rest of the language description without much interest. I didn’t see much else to recommend Python, except maybe that the syntax seemed rather cleaner than Perl’s and the facilities for doing basic GUI elements like buttons and menus looked fairly good.

The fixed spacing is unnerving at first, but that quickly passes, especially when you’re looking at code you wrote 2 years ago or worse, anyone else’s code!

Oddly enough, Python’s use of whitespace stopped feeling unnatural after about twenty minutes… My second came a couple of hours into the project, when I noticed (allowing for pauses needed to look up new features in Programming Python) I was generating working code nearly as fast as I could type. When I realized this, I was quite startled. An important measure of effort in coding is the frequency with which you write something that doesn’t actually match your mental representation of the problem, and have to backtrack on realizing that what you just typed won’t actually tell the language to do what you’re thinking. An important measure of good language design is how rapidly the percentage of missteps of this kind falls as you gain experience with the language.

It’s all about the design of the language and I agree with the author completely when he says, “Most languages have so much friction and awkwardness built into their design.”

The days when it made sense to do your own memory management in a new program are long over, outside of a few specialty areas like kernel hacking, scientific computing and 3-D graphics — places where you absolutely must get maximum speed and tight control of memory usage, because you need to push the hardware as hard as possible… accepting the debugging overhead of buffer overruns, pointer-aliasing problems, malloc/free memory leaks and all the other associated ills is just crazy on today’s machines.

There are a few quirks, but no real gotchas. A few that usually get me are the singleton tuple (is there a better name for this?). A tuple that includes a null must include the comma, and do you include parenthesis around exception names in Except statements or not? This all just proves to me that syntax problems will never disappear completely.

Posted by admica   @   21 December 2009

Related Posts

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

Previous Post
« Effective use of the claymore in Modern Warfare 2
Next Post
What terms and conditions »
Powered by Wordpress   |   Lunated designed by ZenVerse