Purpose of Python Antigravity Module

Oluwafisayo Oluwatayo Oct 10, 2023
  1. Python Antigravity Module
  2. Use Python Zen
  3. Conclusion
Purpose of Python Antigravity Module

Coding is an extremely serious business, you spend time alone in a corner punching code into your keyboard, and if you eventually get to build the application successfully, you then deal with bugs, and deploying the application, it’s an unending chore.

Thankfully, Python has a way of cheering us with its own Easter Eggs. Easter Eggs are when a movie, game, or application has a hidden feature that gets discovered.

One such Python easter egg is the Antigravity Module.

Let us look at what the antigravity module does and look at a few other examples.

Python Antigravity Module

You won’t be blamed if, at first sight, you think the Python antigravity module is designed to make items float or levitate in your Python application.

But it does no such thing. Create a Python file and input these codes:

Code Snippet- new.py:

import antigravity


def main():
    antigravity.fly()


if __name__ == "__main__":
    main()

After you run this application, the terminal returns a message that states, AttributeError: module 'antigravity' has no attribute 'fly'.

Then it refers you to a website with a comic conversation where someone who just learned Python explains to a friend that it made him fly.

SyntaxError: Not a Chance in Python

Imagine trying to run an application, and the error message you receive is SyntaxError: not a chance. That is what this easter produces.

Create a new file, and input this snippet.

Code Snippet- new.py:

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

Use Python Zen

And last but not least, the legendary Zen of Python. While this particular module is an easter egg, it is just as educating as it is entertaining because it serves as guidelines for coding in Python.

Open a new Python file and input this snippet like this:

Code Snippet- new.py:

>>> 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.
It may be a good idea if the implementation is easy to explain.
Namespaces are one honking great idea -- let's do more of those!

Conclusion

There are many interesting easter eggs in the Python framework that helps relieve the tension after a long boring coding session; peruse the internet for your satisfaction.

Oluwafisayo Oluwatayo avatar Oluwafisayo Oluwatayo avatar

Fisayo is a tech expert and enthusiast who loves to solve problems, seek new challenges and aim to spread the knowledge of what she has learned across the globe.

LinkedIn