Skip to main content
Python

The Zen of Python

The Zen of Python  was written by one of the Python core developers, Tim Peter. It is considered as a Python best practice or a  guide to python’s design principles.  The Zen of Python is a list of 19 rules for writing code that embrace the pythonic way of thinking when designing  and writing software codes.  The Zen of Python is very popular among python developer communities  and it is built right into python.

How to access the Zen of Python?

Just open a computer terminal with python installed  and type python3 if you are using a mac  or python if you are using windows. 

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!

Even though you are new to Python, it is a good practice to spend some time reading it and get familiar with it. In the end, that will make you a better python developer and embrace the pythonic way of thinking. Learn more about python…

Leave a Reply