Search

Python's easter eggs and hidden jokes

1. Hello World

>>> import __hello__
Hello World!

2. The classic

>>> import this
The Zen of Python, by Tim Peters
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!

3. The missing line from the classic

The Zen of Python was introduced in PEP 20. It is supposed to be 20 aphorisms, but only 19 of which have been written down.

In many languages there are two ways to do the same thing --no and no--. The message has a hidden example in itself

Support for unicode character set for naming identifiers was added in Python3. Though, it is not explicitly preferred while writing code, it adds flavour to working with scientific formulas

The original code is here with the xkcd comic referenced, and maybe that’s why this is also in the antigravity module

The PEP 401 is an April Fools’ Joke - The PEP’s number is 401, i.e. 4⁄01 or April 1st (April Fools’ Day). The PEP states that Guido van Rossum is stepping down. The new title given to him would be pronounced “BDEVIL” (Benevolent Dictator Emeritus Vacationing Indefinitely from the Language) and Guido’s successor will be Barry Warsaw, or as he is affectionately known, Uncle Barry. Uncle Barry’s official title is “FLUFL” (Friendly Language Uncle For Life). There are in-jokes about the Parrot virtual machine and the “non-existent” Python Secret Underground (possibly a throw-back to “TINC” on USENET).