A Complete Breakfast
00:00
There’s another very similar module, which also is hidden in Python, so you won’t be able to find it in the official documentation. But this time it’s going to be easier if we go to the CPython source code on GitHub because whereas previously we were running the __hello__
module, there’s a package which has a similar name.
00:21
It’s called __phello__
. But since this isn’t a module or a source file with Python, instead it’s a directory, it’s easier to just head to the source code and show the package along with its contents.
00:36 So this hidden folder or package in Python contains some subfolders and nested files, and they have very specific names which have a specific meaning in Python.
00:48
These are ham
, x
, and spam
, or I should say spam
, ham
, and x
, because I think that’s the original order.
00:54 These three names are used throughout Python all over. You can find these names in Python documentation. There are lots of examples that use these particular names and these are called metasyntactic variables.
01:07
Something that you as a developer might be used to seeing names like foobar
or foo
. Whereas most programming languages use names like the just mentioned foo
.
01:17
For those metasyntactic variables, Python programmers prefer spam
, ham
and x
, which is a direct reference to one of Monty Python’s sketches.
01:27 After all, the very name Python is a tribute to the British comedy group.
01:32
Okay, so let’s have a look in the files. So in the __phello__
folder, there is a spam.py
file, right? And it contains some boolean variable.
01:43
And then there’s also the main function which prints Hello, World!
. And then at the bottom, we have the condition, if __name__
equals __main__
, then it calls main()
.
01:53
So you are able to call this, but you would have to specifically refer to this spam
module instead of just the __phello__
package.
02:02
Okay, cool. So there is another "Hello, World!"
that we can find in Python in the source code. Yes. If I recall correctly, these files are also being used in Python’s unit tests.
02:13 So when you are building Python, it would utilize these. So if you were to delete it, it probably, it has the potential to break the unit tests.
02:21
Okay. And I like that one file is x.py
because I mean we are literally talking about x
here while we’re doing a code conversation on Easter eggs.
02:29
So that is very fitting. I like that. Cool. Okay, so being in the browser and talking about "Hello, World"
, there is a famous comic from XKCD, which also features "Hello, World!"
.
02:45 XKCD is a web comic series that goes on for a very long time. I think it was 2015 or something when it started. And it contains those famous stick figure drawings and often very nerdy humor.
03:00 And there is also one comic that features Python. Well, to be clear, not just one. I think the author is a fan of Python and he included at least a few that somehow relate to Python.
03:14 Okay. So is there one that we can connect to an Easter egg in Python? Should we go back to the terminal to look for the Easter egg?
Become a Member to join the conversation.