
If the implementation is easy to explain, it may be a good idea. If the implementation is hard to explain, it's a bad idea. There should be one- and preferably only one -obvious way to do it.Īlthough that way may not be obvious at first unless you're Dutch.Īlthough never is often better than *right* now. In the face of ambiguity, refuse the temptation to guess. Special cases aren't special enough to break the rules. Thanks to his contribution, anyone can view the Zen straight from the Python interpreter by running import this, which you can think of as the Zen of Python command: > import this
Zen of python decoration how to#
How to Print the Zen of Python?īarry Warsaw added the Zen of Python into the Python language as an easter egg back in 2001. In this article, you'll take a look at the different rules of thumb posited by the Zen of Python, as well as how to implement them in your development workflow. It's become a well-known standard for writing clean and elegant Python code, so much so that it was standardized as PEP 20 in 2004. Some might say he helped define zen, at least with regards to Python programming.įor years, Python programmers have used the Zen to scaffold their own development process. The Zen of Python is a list of 20 rules of thumb for writing Pythonic code - that is, code that exhibits the design philosophy that the creators had in mind when developing the language.ġ9 of these rules were submitted to a Python Usenet group back in the late 1990s by none other than Tim Peters, one of Python's core developers. Programming is no different, and for Pythonistas, these best practices are codified into what's known as the Zen of Python. You can easily explain your code to non-technical peersĮvery industry has its "best practices" - a set of guidelines for both newcomers and veterans to follow in order to maximize their contribution to the field.


