in programming, python, tutorial

The Top 5 Easter Eggs in Python

Share Button

Despite being a very serious language, Python is full of Easter eggs and hidden references. This post shows the top 5:

  1. Hello World…
  2. The Zen of Python
  3. Antigravity
  4. C-Style braces instead of indentation
  5. Monthy Python references

I have covered the 5 most interesting features of Python in this post.

1. Hello World…

As a programmer, you should be familiar with Hello World. Python has a library that does that that.

On Python 3 you get a slightly more enthusiastic message: Hello world!. Reimporting the library doesn’t make the message reappear.

2. The Zen of Python

Another hidden library in Python is this, which prints a poem by Tim Peters called The Zen of Python:

3. Antigravity

The most infamous easter egg in Python is the antigravity one, which redirects to an xkcd strip:


4. C-Style braces instead of indentation

Python is designed to be elegant; mandatory indentation is an essential part of this. The library braces were supposed to change this, allowing to use C-Style braces instead of indentation. This is of course a joke, since attempting to import it produces a rather passive-aggressive “not a chance“.

5. Monthy Python references

The name Python has nothing to do with reptiles. Rather the opposite, it comes from the BBC show “Monty Python’s Flying Circus”. As the official Python guide suggests:

Making references to Monty Python skits in documentation is not only allowed, it is encouraged!

This has led developers to include several hidden references not only in the official documentation, but also in their code. For instance in Python, metasyntactic variables takes the names of spam and egg, rather than the more traditionally used foo and bar. This is a clear reference to the Monty Python sketch Spam. You can see this, for example, in the official documentation (Input and otuput) in which there are many other references such as:

From Coursera to Codeacademy, basically every serious Python tutorial make references to Monty Python.

📧 Stay updated

A new tutorial is released every week.

💖 Support this blog

This websites exists thanks to the contribution of patrons on Patreon. If you think these posts have either helped or inspired you, please consider supporting this blog.


Write a Comment



  • Tutorial Series - Alan Zucconi April 11, 2019

    Thank you!