Share your repls and programming experiences

← Back to all posts
Python Easter Egg

Not many people actually know about this easter egg in python.

By typing import this into either a python interpreter or a python shell you can be presented with Tim Peters' 20 aphorisms Guiding principles for writing Python, however, he only wrote down 19, why? I don't know.

Anyway, I'll leave you with that, if you know of any more easter eggs, leave a comment with it!

Have a great Day!

Highwayman (1483)

from __future__ import braces

Highwayman (1483)

@tobyyhsieh thanks!

I hadn’t noticed it had so many upvotes cool.


import this
import antigravity
import __hello__

>>> import this
>>> love = this
>>> this is love
>>> love is True
>>> love is False
>>> love is not True or False
>>> love is not True or False; love is love  # FML

the moudule is:

s = """Gur Mra bs Clguba, ol Gvz Crgref

Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
Syng vf orggre guna arfgrq.
Fcnefr vf orggre guna qrafr.
Ernqnovyvgl pbhagf.
Fcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.
Nygubhtu cenpgvpnyvgl orngf chevgl.
Reebef fubhyq arire cnff fvyragyl.
Hayrff rkcyvpvgyl fvyraprq.
Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.
Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.
Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.
Abj vf orggre guna arire.
Nygubhtu arire vf bsgra orggre guna *evtug* abj.
Vs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.
Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.
Anzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!"""

d = {}
for c in (65, 97):
    for i in range(26):
        d[chr(i+c)] = chr((i+13) % 26 + c)

print("".join([d.get(c, c) for c in s]))
>>> infinity = float('infinity')
>>> hash(infinity)
>>> hash(float('-inf'))
>>> from antigravity import geohash
>>> # Your location, a date and that date's (or most recent) DJIA opening.
>>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68')
37.857713 -122.544543
>>> from math import pi
>>> π = pi
>>> area = π * r**2

>>> résumé = 'knows Python'
>>> 'Python' in résumé
Highwayman (1483)


'Python' in résumé

my favorite that was good lol.


@TaylorLiang Lol, thanks for those.


@Highwayman Nice one

SixBeeps (5234)


import antigravity

is that an xkcd reference? lol

EDIT: It definitely is


@niorg2606 I think so


@niorg2606 if your run it on your own computer (like the python interpriter) it opens up that comic



AtticusKuhn (242)

This is my personal favorite thing to do in my limited knowledge of python

Flux3on (11)

Never have I enjoyed 11 bytes of code more.

Highwayman (1483)

I had forgotten about that..

RobertFurr (64)

from future import braces

PowerCoder (740)

Oh! I've heard about this. Cool! (I never actually tried it.)

PVWalsh (2)


nathancoder (1)

you can also use
import that

KhoiXuanXuan (0)

import antigravity will do some stuff.

eaz (10)

ah yes, the fabled zen of python
the secret 20th part is, because import antigravity makes xkcd canonically part of the python stdlib


@eaz Ah, thanks for that, I never knew that.

AugnivMitra (0)

Also, typing import that You can see The Anti-Zen of Python

leFrank (1)

import that typed in adds more poems

ChoppaFan2007 (3)

wow this sure is a cool post! i love it! but i love my choppa more


@ChoppaFan2007 Ok, Thanks!

ThePhoenixfish (41)

Import that also worked to give the ant zen!

JoelMenezes (18)

@JacksonCowie have you tried import that ?


@JoelMenezes Yeah That one is good as well!

MartiCliment (0)

it seems to also work with:
impot that

--or, in CMD:

pip install that
import that