Every experienced programmer has a favourite language, and a not-so-favourite language. Lewis loves Java — that’s why he develops and presents all the Java-related courses. I once heard Renier describe C as being like poetry. But I think very few programming languages have inspired as much passion and playfulness as Python.
Pythonic People
For example, Python has inspired a fascinating new set of ways to describe people and code. Here are some new definitions to add to your vocabulary:- A Pythonista is a Python loyalist: some one who is passionate about the Python programming language.
- A Pythoneer is an expert (and passionate) Python programmer – think “Python” plus “engineer”. This is often someone who contributes to the range of useful modules available for Python.
- Pythonic is used to describe code that follows the conventions and philosophy of Python.
The Zen of Python
You’ve probably heard the phrase “the Zen of …”. Technically, Zen is a form of Buddhism that emphasizes self-control, meditation, mindfulness and personal insight, rather than religious doctrine. Zen is about being completely present. When we tell people to zen, we mean they should relax and not worry about things they cannot change. Tim Peters wrote a poem called “The Zen of Python”. It is built into the Python interpreter. (The interpreter is the program that “translates” Python code into binary and executes it.) To find it, just typeimport this
in the Python interpreter.
If you haven’t installed Python, here is the poem:
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 a poem, I think it has very little artistic merit. But it does tell you a lot about the philosophy of Python (and the requirements to be Pythonic). And some of the lines actually describe good principles, for life and for programming. Like this one:
In the face of ambiguity, refuse the temptation to guess.
Fly with Python
Here is another slightly weird, but entertaining, fact about Python. If you use the default Python integrated development environment, called IDLE, you can type in the following:import antigravity
The result? It opens a web page with a comic about the antigravity module.