
Most modern Programming languages and software products around come with some hidden functionalities that we usually call "Easter Eggs". In this article, we are going to discuss the purpose of Easter Eggs and why they are implemented in the first place. Additionally, we will explore eight different Easter Eggs that come with Python core language.
What are Easter Eggs in programming languages?
In programming languages and software products in general, an Easter Egg is a hidden piece of functionality or unusual behaviour that usually remains undocumented. It is implemented mostly for entertainment purposes since such functionality doesn’t really serve any purpose in the context of software development. An Easter Egg can come in various forms; from printed text to images or videos.
It is believed that the first Easter Egg was introduced back in 1979 from Warren Robinett at Atari. The company that was operating in the gaming industry, wanted to remove the name of the developers who implemented the game called Adventure, in an attempt to prevent its competitors from hiring them. As a consequence of this policy, a lot of developers -who later on established Activision- decided to leave the company due to lack of acknowledgement for their efforts. However, Robinett who did not leave Atari, decided to embed a hidden piece of functionality that when triggered, would show in the screen a text "Created by Warren Robinett".

Nobody in the company was aware of it as Robinett managed to keep it a secret but it was then revealed by a 15-year old kid who found it out and informed Atari. The teenager even explicitly instructed the company how one can enter the "secret room" and access the easter egg.
I believe that the secret room was discovered independently quite a few times, since there was a pretty strong clue to the existence of the Gray Dot, which was needed to get into the secret room where my signature was. The first person I know of was a fifteen-year-old kid from Salt Lake City who wrote a letter to Atari explaining exactly how to get into the secret room, and asking for Atari’s comments. – Halcyon Days: Warren Robinett
Note that you should always be careful when attempting to include easter eggs into software products as this might have a negative impact on the image of the company. There are many companies that do not allow the implementation of such pieces of functionality. Even if your contract doesn’t have any explicit statement around easter eggs, make sure that you won’t lose your job once the company or a customer finds it out.
Now that we discussed Easter Eggs in the context of software products let’s see 8 known Easter Eggs which are packed in Python core language!
1: All times classic: Hello World
A Hello World program is the simplest program that is usually written by people who are just getting started with programming. The Easter Egg shown below, implements this program and it simply outputs the string "Hello World" to the standard output.
2: The Zen of Python
The Zen of Python is a set of 19 aphorisms, originally written by Tim Peters and introduced in PEP-20. The purpose of this collection is to provide guiding principles around Python’s design. The core language comes with an Easter Egg that prints out these aphorisms to the standard output by simply importing the module this
.
The Zen of Python originally comes with 20 aphorisms. However, only 19 of them will be printed out when importing this
. Now you might be wondering where can you find the 20th aphorism.
Well..we are not going to disclose it in this article. It’s your turn to do some digging!
The fun fact about this
module, is that it pretty much violates most of the aphorisms defined in the Zen of Python. The code that prints the aphorisms looks like below
This code is definitely:
- ugly and not beautiful
- implicit and not explicit
- complex rather than simple
- complicated rather than complex
- nested than flat
- not readable
- implementation is hard to explain
If you are wondering how the code works then probably you can take a closer look at ROT13 (ROTate by 13 places) which is a substitution cipher that was invented in Ancient Rome and is used to replace a letter with the 13th letter after itself.
Note that the Zen of Python is the only Easter Egg which is officially documented.
3: Is anti-gravity real?
This is a nice Easter Egg for comics fans. Once you import the module called antigravity
, a page will be opened on your default browser that shows a comic, which essentially demonstrates how easy is to write and use modules in Python. Note that the tab on your browser will only open once per session.
4: Geohashing
Another interesting Easter Egg added in antigravity
module is the geohash
function, that uses Munroe algorithm that generates random GPS coordinates, based on the DowJones Industrial average on the provided datetime.
The source code of antigravity.py is given below.
5: Braces in Python? That’s never gonna happen…
While most modern programming languages use braces in order to enclose blocks of code under particular commands (e.g. in loops), Python doesn’t go that way. Instead, Python programmers must use indentation to denote blocks of code. And this does not happen just for readability purposes – the Python interpreter will parse indents accordingly and if there’s something wrong with them an exception will be raised.
The Easter Egg below makes fun of other programming languages. When attempting to import braces
from module __future__
, a fairly unusual SyntaxError
will be reported!
6: To the infinity and beyond..

The hash function returns the hash value (i.e. an integer) of an object, if it has one. Interestingly, the hash value of infinity seems to be 314159!
7: Friendly Language Uncle For Life
At the 2009 Python’s Conferences, Barry Warsaw (also known as Uncle Barry) was chosen to be the successor of Guido, who wrote the original implementation of Python back in 1989.
Uncle Barry recognised that the inequality operator !=
that was introduced in Python 3 was a mistake. As of Python 3.1, programmers can revert back to <>
inequality operator by simply importing barry_as_FLUFL
from __future__
module.
8: Naming variables..the Greek way!
Even though using unicode characters when naming variables in your source code is considered to be a bad practise, Python3 introduced a feature that enabled the support of unicode characters when naming identifiers.
The only use-case that probably this could be handy is when writing scientific notations that usually use Greek letters, but again I would personally discourage you from using such characters when naming variables.
Conclusion
In this article, we introduced the meaning of Easter Eggs in the context of programming languages and software products in general. We discussed the history behind the first ever known Easter Egg that was introduced in Atari Adventure game. Furthermore, we explored the eight interesting and fun Easter Eggs which are packed in the Python core programming language.
Enjoy your holidays, keep safe and Happy Easter!