Code Easter Eggs: 7 Secrets Hidden In Programming Languages
We all love a good easter egg level in video games. Those levels where the developers hide a secret room, passageway, or another hidden realm that only a few ever manage to find, and typically they do so by accident.
Few know this, but often the developers behind programming languages create easter eggs of their own. Here are 7 that you may not have found:
Popular Easter Eggs
- In Python, typing
import antigravityin the interactive shell opens up a webcomic created by the language's creator, Guido van Rossum.
- In SQL, using the function
concat()to concatenate the strings "s" and "t" with the argument "ico" produces the word "stonico", a nod to the programming language's creator, Donald D. Chamberlin.
- In Python, adding
from __future__ import braceswill return a syntax error saying "not a chance" in a funny quip about Python not ever using braces or allowing for them to be used.
- If you try and import "this" in Python repl like so:
import this, you will have the 'Zen of Python' returned, 19 aphorisms about Python. Interestingly, there are only 19 aphorisms found in the Zen of Python when rumor suggests there is meant to be 20. You can try and dig deeper and find the 20th yourself or just trust what the internet sleuths have found which is that there isn't a 20th and it's left to your imagination. If you really want to be entertained, go and check out
this.pyand see how this code was written.
- In linux, if you mistype the
lscommand and instead type
sl, you will have a giant locomotive returned in your console.
- Sidekiq allows you to input character emojis flipping over tables with fun responses from the program when you do such as
❨╯°□°❩╯︵┻━┻produces "Take a deep breath and count to ten..." and more.
- Pry ( a Ruby Gem) has a whole file dedicated to Easter Eggs. They mostly consist of poems, but there is also this beautiful one:
pry(main)> nyan-cat. This command triggers a call to the Gem Nyan Cat which showcases the classic Nyan Cat & Audio.
Create Your Own Easter Egg
Konami Code. The Konami code is an infamous sequence of button clicks that a gamer would use on a video game to unlock cheats and secret parts of the game. There are github repositories full of libraries that you can import into your project to include your very own Konami Code into your project. A cheat code as it were. The Konami Code looks like this:
up, up, down, down, left, left, right, right, B, A
I hope you enjoyed and discovered a new easter egg! Let me know if you manage to find any others.