When a programming language is open source, funny and interesting stuff happen. Usually, it means that the contributing community will add funny and special easter eggs and hidden features to the language (though without adding any risk to production usages of course).

Python is a good example to that. Being an open source, the community contributed some of its humor.

Side note: if you're using the "import" easter eggs, please note they'll only work the first time. Just restart the Python shell if you'd like to rerun them.

Hello World

Any programmer is familiar with the concept of Hello World. In most cases, it refers to the minimal program that can be written in that programming language, which prints "Hello World" to the screen. That's probably the first thing you would do when you're learning a new programming language.

Python has a cool hidden library that does something a bit different:

>>> import __hello__ Hello World...

April Fool

The following April fool joke was posted about Barry Warsaw, a well-known Python developer's retirement. As a result, the following easter egg was born:

>>> from __future__ import barry_as_FLUFL >>> 1 <> 2 True

From C++ to Python

The 'braces' library was written as a joke, which is documented to provide the ability to use C++ like braces when writing Python code. When you try to import it from the future, you'll see what the community thinks about that:

>>> from __future__ import braces SyntaxError: not a chance

The Classic One

Running this command will show you the Zen Of Python, written by Tim Peters.

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!

The Anti Gravity Comics

This one will open a funny comics from xkcd.