Python Easter Egg
RogueHalo (398)

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!

You are viewing a single comment. View All
Highwayman (1438)

from __future__ import braces

Highwayman (1438)

@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 (1438)


'Python' in résumé

my favorite that was good lol.

SixBeeps (3504)


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