This Is Locomotion - Design, Code, and News

The Zen of Python

Here’s a brief synopsis on the art form known as the Zen of Python. We’re increasingly finding this meaningful on our MediaCore project, and thought we’d share it with our readers.

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!

3 Responses to “The Zen of Python”

  1. Enjoyed.

    I’ve been struggling with the limitations of PHP as of late. Started working through the Pylons Book [] in the evenings. I almost wish I’d never started. There are too many moments of “WHY CAN’T I DO THIS IN PHP!!!11!!!”

  2. Amen. We’ve had a lot of the same moments. We started off with PHP, then moved to the Zend Framework – got frustrated by how many simple libraries (form libraries especially) were missing or incomplete, and proceeded to move to Python and Pylons. We’re also getting pretty excited about Pyramid which is a new upcoming Python framework that looks pretty awesome.

  3. Hmmm, interesting. I was wondering why the pylons site was rather quiet since the 1.0 release. This explains it. I hadn’t finished the simple site tutorial yet, so I think I’ll just drop that and start learning repoze.bfg. Thanks for the heads up, you’ve saved me at least a week or two of reading :)