+1 tag for Google+

Wednesday, 7 September 2016

The Zen of Python: Import This

I have been coding quite a bit in Python these few months.

In the midst of research and reading up, I revisited the Zen of Python. This is a set of 20 software principles that influenced the development of the language.

Having read this a few years back (it was first written around 1999), now I am seeing some of the principles in a new light. I'm still learning and finding my way around so I decided to learn more about what these principles mean to different people.

Here's a great presentation I found on Slideshare.net when I dug deeper into how different people explain each of these 20 principles in their own ways.

Incidentally I just found out that the Zen of Python is coded into the language itself. You can get Python to display this by entering this line of code:

import this

It will return the following result, right inside your interpreter:

The Zen of Python, by Tim Peters

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!