The Zen of Pi

--Originally published at Codebuster

Each programming language comes with a set of coding conventions, which are basically a 101 for recommended programminh styles, file organization, programming principles and such. Their main function is for people to improve readability of the source code making software maintanance easier.

This cinventions for python are appropiately called the Zen of Python and they are 20 (sometimes considered 19) principles written by Tim Peters around June 1999, and read as follows.

 

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!

I took the liberty of highlighting in pink my favorite ones, and the ones I feel represent python the most (at least for me), since python’s most distinctive feature its simple way of coding and readability, as once Harold Abeson said…

“Programs must be written for people to read, and only incidentally for machines to execute.” – Harold Abeson, Structure and interpretation of computer programs

 

tumblr_me3zq62GuN1r6h22v.gif