{"id":13489874,"url":"https://github.com/OrkoHunter/python-easter-eggs","last_synced_at":"2025-03-28T05:31:23.804Z","repository":{"id":20704911,"uuid":"90676745","full_name":"OrkoHunter/python-easter-eggs","owner":"OrkoHunter","description":"Curated list of all the easter eggs and hidden jokes in Python","archived":false,"fork":false,"pushed_at":"2023-06-22T12:26:39.000Z","size":39,"stargazers_count":447,"open_issues_count":1,"forks_count":54,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-03-22T03:06:43.773Z","etag":null,"topics":["easter-egg","python"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OrkoHunter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-05-08T22:07:10.000Z","updated_at":"2025-03-06T01:51:03.000Z","dependencies_parsed_at":"2024-01-16T09:01:10.764Z","dependency_job_id":"d19ea1e0-c1cb-47e2-97b5-dd3071e658e2","html_url":"https://github.com/OrkoHunter/python-easter-eggs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrkoHunter%2Fpython-easter-eggs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrkoHunter%2Fpython-easter-eggs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrkoHunter%2Fpython-easter-eggs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrkoHunter%2Fpython-easter-eggs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OrkoHunter","download_url":"https://codeload.github.com/OrkoHunter/python-easter-eggs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245978200,"owners_count":20703675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["easter-egg","python"],"created_at":"2024-07-31T19:00:36.959Z","updated_at":"2025-03-28T05:31:22.078Z","avatar_url":"https://github.com/OrkoHunter.png","language":null,"readme":"\u003e Just when you thought, Python could not be more fun.\n\n### 1. Hello World[^hello-world]\n\n```py\n\u003e\u003e\u003e import __hello__\nHello World!\n\u003e\u003e\u003e import __phello__\nHello world!\n```\n\nHello world for python \u003e= 3.11\n\n```py\n\u003e\u003e\u003e import __hello__\n\u003e\u003e\u003e __hello__.main()\nHello World!\n\u003e\u003e\u003e import __phello__\n\u003e\u003e\u003e __phello__.main()\nHello World!\n```\n\n### 2. The classic[^the-classic]\n```\n\u003e\u003e\u003e import this\n\nThe Zen of Python, by Tim Peters\n\nBeautiful is better than ugly.\nExplicit is better than implicit.\nSimple is better than complex.\nComplex is better than complicated.\nFlat is better than nested.\nSparse is better than dense.\nReadability counts.\nSpecial cases aren't special enough to break the rules.\nAlthough practicality beats purity.\nErrors should never pass silently.\nUnless explicitly silenced.\nIn the face of ambiguity, refuse the temptation to guess.\nThere should be one-- and preferably only one --obvious way to do it.\nAlthough that way may not be obvious at first unless you're Dutch.\nNow is better than never.\nAlthough never is often better than *right* now.\nIf the implementation is hard to explain, it's a bad idea.\nIf the implementation is easy to explain, it may be a good idea.\nNamespaces are one honking great idea -- let's do more of those!\n```\n\n### 3. The missing line from the classic[^missing-zen]\n\nThe Zen of Python was introduced in [PEP 20](https://www.python.org/dev/peps/pep-0020/#id2). It is supposed to be 20 aphorisms, but only 19 of which have been written down.\n\n\n### 4. A simple life lesson[^import-this]\n```py\n\u003e\u003e\u003e import this\n...\n\u003e\u003e\u003e love = this\n\u003e\u003e\u003e this is love\nTrue\n\u003e\u003e\u003e love is True\nFalse\n\u003e\u003e\u003e love is False\nFalse\n\u003e\u003e\u003e love is not True or False\nTrue\n\u003e\u003e\u003e love is not True or False; love is love  # FML\nTrue\n```\n\n### 5. Comics, yeah.[^antigravity]\n```py\n\u003e\u003e\u003e import antigravity\n```\n\n### 6. It's not a choice, it defines who we are[^braces]\n```py\n\u003e\u003e\u003e from __future__ import braces\n  File \"\u003cstdin\u003e\", line 1\nSyntaxError: not a chance\n```\n\n### 7. Origins[^origins]\nThe name Python has nothing to do with the type of Snake.\n\n### 8. The confuscation[^this-py]\nThis is how the `this.py` module looks, which prints the Zen of Python.\n\n```py\ns = \"\"\"Gur Mra bs Clguba, ol Gvz Crgref\n\nOrnhgvshy vf orggre guna htyl.\nRkcyvpvg vf orggre guna vzcyvpvg.\nFvzcyr vf orggre guna pbzcyrk.\nPbzcyrk vf orggre guna pbzcyvpngrq.\nSyng vf orggre guna arfgrq.\nFcnefr vf orggre guna qrafr.\nErnqnovyvgl pbhagf.\nFcrpvny pnfrf nera'g fcrpvny rabhtu gb oernx gur ehyrf.\nNygubhtu cenpgvpnyvgl orngf chevgl.\nReebef fubhyq arire cnff fvyragyl.\nHayrff rkcyvpvgyl fvyraprq.\nVa gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff.\nGurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg.\nNygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbh'er Qhgpu.\nAbj vf orggre guna arire.\nNygubhtu arire vf bsgra orggre guna *evtug* abj.\nVs gur vzcyrzragngvba vf uneq gb rkcynva, vg'f n onq vqrn.\nVs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn.\nAnzrfcnprf ner bar ubaxvat terng vqrn -- yrg'f qb zber bs gubfr!\"\"\"\n\nd = {}\nfor c in (65, 97):\n    for i in range(26):\n        d[chr(i+c)] = chr((i+13) % 26 + c)\n\nprint(\"\".join([d.get(c, c) for c in s]))\n```\n\nThe code for the Zen violates itself. It's not beautiful but ugly, not explicit but implicit.\nThis would probably be the *only* module to go against the spirit of what it says itself.\n.\n\n### 9. C/C++ anyone?[^c-c++]\nFrom the Zen again,\n```\nThere should be one-- and preferably only one --obvious way to do it.\n```\n\n### 10. Naming identifiers can be unspeakably cool[^identifiers]\nJust when you thought that working in Python couldn't possibly *be* any more fun,\n```py\n\u003e\u003e\u003e from math import pi\n\u003e\u003e\u003e π = pi\n\u003e\u003e\u003e area = π * r**2\n\n\u003e\u003e\u003e résumé = 'knows Python'\n\u003e\u003e\u003e 'Python' in résumé\nTrue\n```\n\n### 11. Picking a place for meetup?[^geohash]\n```py\n\u003e\u003e\u003e from antigravity import geohash\n\u003e\u003e\u003e # Your location, a date and that date's (or most recent) DJIA opening.\n\u003e\u003e\u003e geohash(37.421542, -122.085589, b'2005-05-26-10458.68')\n37.857713 -122.544543\n```\nThis can generate a GPS coordinate in a region which is 1 longitude long and 1\nlatitude wide based on your location.\n\n### 12. The FLUFL - Friendly Language Uncle For Life from [PEP 401 -- BDFL Retirement](https://www.python.org/dev/peps/pep-0401)[^pep-401]\n```py\n\u003e\u003e\u003e from __future__ import barry_as_FLUFL\n\u003e\u003e\u003e 1 \u003c\u003e 2\nTrue\n\u003e\u003e\u003e 1 != 2\n  File \"\u003cstdin\u003e\", line 1\n    1 != 2\n       ^\nSyntaxError: invalid syntax\n```\nRecognized that the != inequality operator in Python 3.0 was a horrible, finger pain inducing mistake, the FLUFL reinstates the \u003c\u003e diamond operator as the sole spelling.\n\n### 13. InPynite?[^inpynite]\n```py\n\u003e\u003e\u003e infinity = float('infinity')\n\u003e\u003e\u003e hash(infinity)\n314159\n\u003e\u003e\u003e hash(float('-inf'))\n-314159\n```\nA hash is a fixed sized integer that identifies a particular value. On a closer look, the hash of infinity is 10^5 x pi. Interestingly, hash(float('-inf')) yields -10^5 x pi in python3, whereas -271828 i.e - 10^5 x e in python2.\n\n### 14. types.CodeType -  Not for the faint of heart\nIf you start digging deep into Python's internals you will get a warning in `help` output for `types.CodeType`\n```py\n\u003e\u003e\u003e import types\n\u003e\u003e\u003e help(types.CodeType)\n...\nHelp on class code in module builtins:                                                    \n                                                                                          \nclass code(object)                                                                        \n |  code(argcount, kwonlyargcount, nlocals, stacksize, flags, codestring,                 \n |        constants, names, varnames, filename, name, firstlineno,                        \n |        lnotab[, freevars[, cellvars]])                                                 \n |                                                                                        \n |  Create a code object.  Not for the faint of heart.                                    \n |                                                                                        \n |  Methods defined here:                                                                 \n |                                                                                                                                       \n ...\n ```\n\n### 15. Python 3.9 PEG parser[^peg-parser]\n`__peg_parser__` is a keyword in python 3.9, will throw a syntax error if used\n```py\n\u003e\u003e\u003e __peg_parser__\n  File \"\u003cstdin\u003e\", line 1\n    __peg_parser__\n    ^\nSyntaxError: You found it!\n```\n\n[^hello-world]: Easiest hello world program in a language without calling any function\n[^the-classic]: Each and every line is the philosophy of Python's design and is a supreme holy guide\n[^missing-zen]: Maybe just to show that there always should be a new line at the end of a file!\n[^import-this]: Not an easter egg, a joke in the interpreter\n[^antigravity]: It opens this [xkcd comic](https://xkcd.com/353) which demonstrates how easy it is to do stuff with modules\n[^braces]: This is to instantly close down any conversation about introducing curly braces to Python\n[^origins]: Guido van Rossum is a big fan of [Monty Python's Flying Circus](https://en.wikipedia.org/wiki/Monty_Python%27s_Flying_Circus)\n[^this-py]: It's a substitution cipher called [ROT13](https://en.wikipedia.org/wiki/ROT13)\n[^c-c++]: In many languages there are two ways to do the same thing `--no` and `no--`. The message has a hidden example in itself\n[^identifiers]: Support for unicode character set for naming identifiers was added in Python3. Though, it is not explicitly preferred while writing code, it adds flavour to working with scientific formulas\n[^geohash]: The original code is [here](https://github.com/python/cpython/blob/master/Lib/antigravity.py) with the [xkcd comic](https://xkcd.com/426/) referenced, and maybe that's why this is also in the `antigravity` module\n[^pep-401]: The [PEP 401](https://www.python.org/dev/peps/pep-0401/) is an April Fools' Joke - The PEP's number is 401, i.e. 4/01 or April 1st (April Fools' Day). The PEP states that Guido van Rossum is stepping down. The new title given to him would be pronounced \"BDEVIL\" (Benevolent Dictator Emeritus Vacationing Indefinitely from the Language) and Guido's successor will be Barry Warsaw, or as he is affectionately known, Uncle Barry. Uncle Barry's official title is \"FLUFL\" (Friendly Language Uncle For Life). There are in-jokes about the Parrot virtual machine and the \"non-existent\" Python Secret Underground (possibly a throw-back to [\"TINC\" on USENET](https://en.wikipedia.org/wiki/There_Is_No_Cabal)).\n[^inpynite]: [Source](https://www.reddit.com/r/Python/comments/6wrd8t/nice_lil_easter_egg_i_suppose/).\n[^peg-parser]: See [this answer](https://stackoverflow.com/a/65487013/14362510)\n\n## Add more\n\nPlease feel free to create a PR and add more!\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOrkoHunter%2Fpython-easter-eggs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOrkoHunter%2Fpython-easter-eggs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOrkoHunter%2Fpython-easter-eggs/lists"}