Skip to content
Related Articles
Open in App
Not now

Related Articles

Top 5 Easter Eggs in Python

Improve Article
Save Article
Like Article
  • Last Updated : 22 Jul, 2021
Improve Article
Save Article
Like Article

Python is really an interesting language with very good documentation. In this article, we will go through some fun stuff that isn’t documented and so considered as Easter eggs of Python.

1. Hello World 

Most of the programmers should have started your programming journey from printing “Hello World!”. Would you believe that Python has a secret module to print “Hello World” and the name of the module is __hello__


import __hello__ 


Hello world!

2. Antigravity

If you feel bored typing code all day, then check the antigravity module in Python which redirects you to a web-comic.


# redirects you to
import antigravity

3. Zen of Python

“Zen of python”  is a guide to Python design principles.  It consists of 19 design principles and it is written by an American software developer Tim Peters. This is also by far the only ‘official’ Easter egg that is stated as an ‘Easter egg’ in Python Developer’s Guide. You can see them by importing the module “this”.


import this


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!

4. The FLUFL [Friendly Language Uncle For Life]

Recognized that the != inequality operator in Python 3.0 was a horrible, finger pain-inducing mistake, the FLUFL reinstates the <> diamond operator as the sole spelling.


from __future__ import barry_as_FLUFL
1 <> 2
1 != 2


SyntaxError: with Barry as BDFL, use '<>' instead of '!='

5. Braces

Unlike most of the language, Python uses indentation instead of curly braces “{ }”. While making a transition from languages like C++ or JAVA to Python it is a bit difficult to adapt to indentation. Thus if we try to use braces using __future__ module, Python gives a funny reply “not a chance”.


from __future__ import braces


File "<stdin>", line 1
SyntaxError: not a chance

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!