Python Culture

Looking at software projects, each has its own culture and style, a distinct approach to solving problems. One such style I’ve always been drawn to is Python and its almost zen like ways to keep it simple and friendly.

There is also a playfulness and humor of Python. First most being the fact the language is named after the comedy troupe Monty Python. You can also see the playfulness of the founder Guido in some of the photos posted on his site and on this python humor page. This is a language that doesn’t take itself too seriously.

Guiding Principles: The Zen of Python

In June 1999, Tim Peters listed out nineteen guiding principles for Python posted on comp.lang.python. Note these are not hard-and-fast rules but a foundation for understanding the python mind. You can get the list yourself by typing import this in the Python REPL.

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!

Again, these are just guiding principles and shouldn’t be considered law, the thou shalts are reserved for PEP-8. These principles are useful to keep in mind when architecting your system, or if you start to get a little clever or tricky in your coding, oh yeh keep it simple and explicit.

At the core, one of the best parts of the Python culture is keeping in mind that developers are people, and they will have to read your code later. Be nice to each other.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s