1.5 Zen of Python
In 1999, a software developer and major contributor to Python named Tim Peters wrote the Zen of Python. It established 19 aphorisms, concise or forcefully expressive observations with general truth, regarding Python design. For those that have already learned a programming language and found it difficult to understand, you might find these observations amusing and nod your head in agreement. For those being introduced to programming and feeling like they have very little technical background, humor me and smile because by the end of this material these will all make more sense. The 19 aphorisms include (NOTE: When reading these, think about writing programming code. For those learning how to program, these become your mantra for writing code):
- 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!
As you can see, these aphorisms form a wonderful set of “golden rules” for application development using Python.
One common point that should be established is that the Python programming language should be used if you want to write simple, readable code. In other words, you can use this programming language to get your job done writing fewer lines of source code.