Hunting for Python Easter Eggs - Code Conversation

Real Python · Beginner ·🛠️ AI Tools & Apps ·2y ago

Key Takeaways

The video explores Easter eggs in software, including the first Easter egg in a video game and Python's built-in __hello__ module, using tools like Google Chrome, Brave browser, and Python.

Full Transcript

welcome to another real python code conversation I'm philli a real python team member and I'm going to have a conversation with Bartos who is another real python team member this code conversation is a bit different to other real python code conversations you might have seen the emphasis this time is more on the conversation part BOS will take you on an Easter egg hunt you'll learn about the history of software development and some hidden gems in Python however there won't be that many code examples so you can treat this code conversation a bit like a podcast episode lean back and listen to the interesting things that Bartos has to say Enjoy when we're talking about Easter egg what are we actually talking about what has this to do with software development and why is this an interesting topic to talk about yeah in the traditional sense for those of you who don't know Easter eggs are hardboiled eggs which are decorated in various patterns and paints but they also mean something entirely different in the software engineering particularly video games and this is exactly what we're going to talk about today yeah I remember this from my childhood like we actually had Easter egg hunts in in Germany so when it was Easter Sunday our parents were hiding uh Easter eggs in the garden and we we kids had to wait inside and then you went outside with a little basket and all the kids needed to find Easter eggs and in the end you were comparing who found the most and who found the most interesting ones often there were not only boring boiled eggs but chocolate eggs which is a bit more interesting oh yeah especially as a kid right still as an adult I guess yeah and you were mentioning in software development there is something similar there are also little interesting details that are hidden somewhere in video game software sometimes even films and also in Python but maybe before we go into the python world do you know of any popular Easter eggs or some examples that our viewers might already know absolutely but before we do this I would actually like to go take a step back and explain a little more about the concept of Easter egg and software like you mentioned there was this game called The Egg Hunt game and it's a very similar Concept in programming so it's like a little game for people to entertain themselves and find some jokes and hidden secrets in software it's mostly about this eggun game which is funny because I live in Poland and Easter is huge in Poland but I've never heard of egg hunt game in my life before I literally asked my wife and she said oh yeah sure I know what that is you know from TV but in our childhood we never played that game so I was really curious to find out what it is all about and it turns out that yeah parents just hide those eggs somewhere and the kids are after them and the idea was with Easter egg in software is kind of similar where the developers the original creators put these secret messages jokes hidden something in the software and they don't tell anyone about it they just wait until someone discovers it and that becomes popular there are many examples in software that you might be aware of so for instance if you're using a web browser which is based on the open source chromium project like Google Chrome or the recent Brave browser you have to be offline to experience this so when there's no internet access and you go somewhere it displays this little dinosaur along with a boring message that there's no internet which is of course quite familiar and do you know why they put this T-rex dinosaur there I was always wondering I I thought it was maybe because Mozilla or something like that and having a dinosaur there yeah I was scratching my head once too and apparently it was an inside joke and they wanted to refer to the prehistoric times where there was no internet so when you have no internet access they show this little dinosaur to emphasize that it's like living in the prehistoric times these days without internet anymore that makes total sense and I mean this alone already is kind of like a little Easter egg because it's probably a joke that developers had but I guess there is a bit more to this dinosaur as well it's not just an image that's showing there yeah you're quite right right when you hit a space bar or your up Arrow key on the keyboard you can actually start playing the dinosaur so it starts this little game inside your browser to entertain yourself where there's no internet and you can jump you can Crouch to avoid the enemies and obstacles and score points so there's a little hidden game which you might have not known before and this is a great example of an Easter egg in your web browsers so Easter eggs are super popular in video games that's the probably the biggest type of software where you would go and find those Easter eggs but that's not the rule there are some professional software applications which also include Easter eggs perhaps one of the most famous ones was Microsoft Excel they featured a whole flight simulator that which is crazy inside Excel so you would type some cryptic message into a cell and then you would use a particular key combination and would open up this flight simulator right in your Excel which is quite funny given you know Excel is considered professional software for business applications and yet you can play game inside of it that is so funny I didn't know about this one and I mean it's like you can pretend to work on big numbers but actually you're playing flight simulator that's quite cool yeah but they they changed their take on Easter XG I mean Microsoft and at some point they decided that you know they want to to become a serious company and they removed all the Easter eggs from their software at least that's what they're saying so you won't find this flight simulator in Excel anymore unfortunately unlike other companies like Google for instance is still pretty big on Easter eggs if you go to a Wikipedia article that lists all the Easter eggs in Google products and services it's it's a pretty long list yeah I think that's a good example of the developers also having fun and not just publishing the corporate software but also leaving some like maybe little bugs in that are not harmful or or something like this and maybe Microsoft only wants you to think that there are no Easter eggs so if any viewers find some Easter X in a Microsoft product let us know in the comments below because maybe they are still out there do you know one of the first appearances of of an Easter EG in software development I know I checked the Wikipedia before recording this so that's how I know apparently perhaps the first Easter egg in software known to humanity is from early 1980s from a video game and Atari didn't want to credit their developers and they they wouldn't show the names of developers who were working on the game for different reasons one of them was because they didn't want other companies to go after their developer and there was one programmer who didn't like this he really wanted to be credited he wanted his work to be acknowledged for his efforts of course he secretly put his name in the game without telling his bosses so the player would have to do something specific in the game to find that secret room or something where it would display the the name of the developer and that's how the concept of Easter egg was created initially the company decided to remove it they didn't like it but you know it wasn't the internet times yet so they would have to release a new version without Easter that Easter egg but that proved to be too costly so they decided to keep it and actually they they liked it because you know the players also enjoyed looking after those Easter eggs so that's how it all started and one cool thing is that you as a python programmer and with you I mean you as a viewer but also so you BOS can still find some Easter eggs in python python is one of the places where you can go on an Easter egg hunt and that's something that we want to do today and find some Easter eggs in Python that's right any Journey as a programmer we often start with uh hello world programs and there are some things that we can actually uncover in Python but before we go to the Easter egg how does like a typical hello world program look in Python well in Python it's pretty straightforward you just call the print function open parenthesis and inside you put a string which says hello world exclamation mark and it prints the string hello world but uh it's interesting that you're asking specifically about the hello world implementation in Python because writing hello world in Python is fairly straightforward but if you ask me how to write hello world in Java I'm not sure if I would be able to do this at the first try probably it would take maybe two because of the complicated syntax that is true but there is even a way on how to get a Hello World message in Python without even writing code right yeah philli you're right it turns out there's an even simpler way to implement hello world in Python which doesn't even include writing a single line of code because python comes with Hello World built-in so you can actually run a module that is in Python standard library and to run a python module you type the python command whoops Python and then you supply the dash M option which stands for module and then you just specify the name of the module and it's interesting because you won't find it in the official documentation if I recall correctly but if you look at the source code there is a funny looking module name which is called double underscore hello double underscore or using Python's lingo the double underscore is often abbreviated to Dunder so it's Dunder hello Dunder and if I hit enter it's will well print the hello world so someone already has implemented hello world for us in Python the dunder hello module is a perfect example of an Easter egg because it's concealed if you go to the official python documentation you won't be able to find it for example if you navigate to the docs. python.org and typed under hello it won't show up because even though it's in Python it's not documented on purpose but since you're running python locally you can find that file and view its source code you could also go to cpython source code on GitHub and look it up there but um probably the quickest way would be to use something like bpy which is a cool little wrapper around the standard python repple or read evaluate print Loop and when you import something like thunder hello and then you use a keyboard shortcut under your csor I think it's the default one is F2 it will show you the source code in here we can see we have some variable called initialized we have a few classes and the main function and it turns out that these few classes aren't completely useless because they're actually used in the unit test in Python if I recall correctly M so this module isn't just an Easter egg it's actually being used by the unit test in Python and then we have the main function which is the entry point to that module which means that when you run this module the way I showed it before using python dasm option it will run the main function in here and it will print the hello world text on the screen

Original Description

This is a preview of a Code Conversation titled, "Finding Python Easter Eggs." In this conversation you’ll follow a chat between Philipp and Bartosz as they go on an Easter egg hunt. Along the way, you’ll: Learn about Easter egg hunt traditions Uncover the first Easter egg in software Explore Easter eggs in Python There won’t be many code examples in this Code Conversation, so you can lean back and join Philipp and Bartosz on their Easter egg hunt. This is a preview of the complete course, which you can find here: https://realpython.com/courses/python-basics-modules-packages/ The rest of the course covers: - The hidden humor in the Python language - Special PEPs - Defying Gravity
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Real Python · Real Python · 0 of 60

← Previous Next →
1 A better Python REPL – bpython vs python interpreter
A better Python REPL – bpython vs python interpreter
Real Python
2 Introducing large-type.com – A Utility Website
Introducing large-type.com – A Utility Website
Real Python
3 Reading Hacker News Without Wasting Tons of Time
Reading Hacker News Without Wasting Tons of Time
Real Python
4 Forward References and Python 3 Type Hints
Forward References and Python 3 Type Hints
Real Python
5 Using Sublime Text as your Git Editor
Using Sublime Text as your Git Editor
Real Python
6 Python Code Linting and Auto-Complete for Sublime Text
Python Code Linting and Auto-Complete for Sublime Text
Real Python
7 Make your Python Code More Readable with Custom Exceptions
Make your Python Code More Readable with Custom Exceptions
Real Python
8 Write Better Tests with Sublime Text's Split Layout Feature
Write Better Tests with Sublime Text's Split Layout Feature
Real Python
9 How to Use Sublime Text from the Command Line
How to Use Sublime Text from the Command Line
Real Python
10 Rename Variables with Multiple Selection in Sublime Text
Rename Variables with Multiple Selection in Sublime Text
Real Python
11 Sublime Text Settings for Writing PEP 8 Python
Sublime Text Settings for Writing PEP 8 Python
Real Python
12 Write Cleaner Python with Sublime Text's Indent Guides
Write Cleaner Python with Sublime Text's Indent Guides
Real Python
13 Sublime Text Whitespace Settings for Python Development
Sublime Text Whitespace Settings for Python Development
Real Python
14 Function Argument Unpacking in Python
Function Argument Unpacking in Python
Real Python
15 Python Code Review: Debugging and Refactoring "Conway's Game of Life" +  Automated Tests
Python Code Review: Debugging and Refactoring "Conway's Game of Life" + Automated Tests
Real Python
16 Using "get()" to Return a Default Value from a Python Dict
Using "get()" to Return a Default Value from a Python Dict
Real Python
17 A Python Shorthand for Swapping Two Variables
A Python Shorthand for Swapping Two Variables
Real Python
18 Python Code Review: Refactoring a Web Scraper, PEP 8 Style Guide Compliance, requirements.txt
Python Code Review: Refactoring a Web Scraper, PEP 8 Style Guide Compliance, requirements.txt
Real Python
19 Click & Jump to Test Failures from the Command Line (iTerm2)
Click & Jump to Test Failures from the Command Line (iTerm2)
Real Python
20 Setting up Sublime Text for Python Developers
Setting up Sublime Text for Python Developers
Real Python
21 Sublime Text + Python Guide Overview
Sublime Text + Python Guide Overview
Real Python
22 Python Code Review: Adding Pytest Tests to an Existing Python Web Scraper
Python Code Review: Adding Pytest Tests to an Existing Python Web Scraper
Real Python
23 Type-Checking Python Programs With Type Hints and mypy
Type-Checking Python Programs With Type Hints and mypy
Real Python
24 A Shorthand for Merging Dictionaries in Python 3.5+
A Shorthand for Merging Dictionaries in Python 3.5+
Real Python
25 Python Code Review Flask Web Security Tutorial + Virtualenvs, requirements.txt
Python Code Review Flask Web Security Tutorial + Virtualenvs, requirements.txt
Real Python
26 My Python Code Looks Ugly and Confusing – Help!
My Python Code Looks Ugly and Confusing – Help!
Real Python
27 Setting Up a Programmer Portfolio/Developer Blog – How To Get Started
Setting Up a Programmer Portfolio/Developer Blog – How To Get Started
Real Python
28 Do I Need a GitHub/GitLab/Bitbucket Profile as a Developer?
Do I Need a GitHub/GitLab/Bitbucket Profile as a Developer?
Real Python
29 Programmer Portfolio – Example and Walkthrough
Programmer Portfolio – Example and Walkthrough
Real Python
30 How to Get Your 1st Speaking Gig at a Tech Conference
How to Get Your 1st Speaking Gig at a Tech Conference
Real Python
31 How to Build Your Public Speaking Skills as a Developer
How to Build Your Public Speaking Skills as a Developer
Real Python
32 The Object-oriented Version of "Spaghetti Code" is "Lasagna Code" ?!
The Object-oriented Version of "Spaghetti Code" is "Lasagna Code" ?!
Real Python
33 Setting up Sublime Text for Python Developers – Lesson #1
Setting up Sublime Text for Python Developers – Lesson #1
Real Python
34 Cool New Features in Python 3.6
Cool New Features in Python 3.6
Real Python
35 "is" vs "==" in Python – What's the Difference? (And When to Use Each)
"is" vs "==" in Python – What's the Difference? (And When to Use Each)
Real Python
36 Emulating switch/case Statements in Python with Dictionaries
Emulating switch/case Statements in Python with Dictionaries
Real Python
37 Python Function Argument Unpacking Tutorial (* and ** Operators)
Python Function Argument Unpacking Tutorial (* and ** Operators)
Real Python
38 What Code Should I Put On My GitHub/GitLab/BitBucket Profile?
What Code Should I Put On My GitHub/GitLab/BitBucket Profile?
Real Python
39 A Crazy Python Dictionary Expression ?!
A Crazy Python Dictionary Expression ?!
Real Python
40 String Conversion in Python: When to Use __repr__ vs __str__
String Conversion in Python: When to Use __repr__ vs __str__
Real Python
41 Method Types in Python OOP: @classmethod, @staticmethod, and Instance Methods
Method Types in Python OOP: @classmethod, @staticmethod, and Instance Methods
Real Python
42 Optional Arguments in Python With *args and **kwargs
Optional Arguments in Python With *args and **kwargs
Real Python
43 Python Context Managers and the "with" Statement (__enter__ & __exit__)
Python Context Managers and the "with" Statement (__enter__ & __exit__)
Real Python
44 Installing Python Packages with pip and virtualenv / venv
Installing Python Packages with pip and virtualenv / venv
Real Python
45 "For Each" Loops in Python with enumerate() and range()
"For Each" Loops in Python with enumerate() and range()
Real Python
46 Python Code Review: LibreOffice Automation and the Python Standard Library
Python Code Review: LibreOffice Automation and the Python Standard Library
Real Python
47 Managing Python Dependencies With Pip and Virtual Environments – Lesson #1
Managing Python Dependencies With Pip and Virtual Environments – Lesson #1
Real Python
48 Python Tutorial: List Comprehensions Step-By-Step
Python Tutorial: List Comprehensions Step-By-Step
Real Python
49 Leveraging Python's Implicit "return None" Statements
Leveraging Python's Implicit "return None" Statements
Real Python
50 What's the meaning of underscores (_ & __) in Python variable names?
What's the meaning of underscores (_ & __) in Python variable names?
Real Python
51 Python Data Structures: Sets, Frozensets, and Multisets (Bags)
Python Data Structures: Sets, Frozensets, and Multisets (Bags)
Real Python
52 Writing automated tests for Python command-line apps and scripts
Writing automated tests for Python command-line apps and scripts
Real Python
53 How to find great Python packages on PyPI, the Python Package Repository
How to find great Python packages on PyPI, the Python Package Repository
Real Python
54 Immutable vs Mutable Objects in Python
Immutable vs Mutable Objects in Python
Real Python
55 PyPI vs Warehouse, the Next-Generation Python Package Repository
PyPI vs Warehouse, the Next-Generation Python Package Repository
Real Python
56 pep8.org — The Prettiest Way to View the PEP 8 Python Style Guide
pep8.org — The Prettiest Way to View the PEP 8 Python Style Guide
Real Python
57 My Experience at PyCon 2017 in Portland
My Experience at PyCon 2017 in Portland
Real Python
58 Pylint Tutorial – How to Write Clean Python
Pylint Tutorial – How to Write Clean Python
Real Python
59 "Reverse a List in Python" Tutorial: Three Methods & How-to Demos
"Reverse a List in Python" Tutorial: Three Methods & How-to Demos
Real Python
60 Python Refactoring: "while True" Infinite Loops & The "input" Function
Python Refactoring: "while True" Infinite Loops & The "input" Function
Real Python

This video teaches viewers about the concept of Easter eggs in software, their history, and how to find them in Python. Viewers will learn how to access Python's built-in __hello__ module and understand its purpose.

Key Takeaways
  1. Learn about Easter egg traditions
  2. Explore the first Easter egg in software
  3. Access Python's __hello__ module using python -m __hello__
  4. Run the module using the python dasm option
  5. Discover the purpose of the __hello__ module in Python's unit test
💡 Python's built-in __hello__ module is not just an Easter egg, but also used in the unit test, making it a unique and interesting example of hidden functionality in software.

Related Reads

Up next
Best AI Tools for Social Media Marketing in 2026 (Beginner-Friendly AI Tools)
Pin Generator
Watch →