26 January 2010

Zen of Python


I recently came across this little piece by Tim Peters, titled The Zen of Python (the programming language, not the snake). I'm not a programmer, but it seems to me that these principles are relevant to all sorts of creative pursuits, including system development and design (which IS something I do).

I'm not sure I understand everything he's talking about, and I probably think I understand more than I actually do. If I understood more, I might quibble over a line or two. But nonetheless, I think this is worth reading and pondering. And just in case the image above is difficult to read, here it is in plain text:


The Zen of Python
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

4 comments:

Glen B. Alleman said...

Great ideas,
I'll think about how these can be fleshed out for IMP/IMS based programs

Phil said...

@Dan, in the for what it's worth category, Jake (my 13-yr old) has decided he wants to learn how to program (to be a video game designer, you know), so we chose to start with Python. I'm impressed with the language and the org behind it (open source). Great freeware interpreters and compilers and lots of free online tutorials. And, as Mr Peters espouses, very FISTY.

The Dan Ward said...

@Phil - That's so cool! I look forward to hearing how that goes... and to playing Jake's games someday. :)

RhetTbull said...

Hi Dan. I had some comments on this but they wouldn't fit in your comment block! So I posted over at my posterous blog. Cheers,
Rhet