You of course know what happens when you import this
, but where is the Zen located in the interpreter source code?
I'd searched the string "Readability counts" in a local clone but haven't found anything relevant.
Searching "zen of python" site:hg.python.org
in Google gives me no result at all.
Thanks to his contribution, anyone can view the Zen straight from the Python interpreter by typing import this : >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit.
Python code is not compiled into machine-code. It is compiled into a special low-level intermediary language called bytecode that only CPython understands. This code is stored in . pyc files in a hidden directory and cached for execution.
As soon as we'd chosen "import this" I realized we just had to implement it. Python 2.2 was about to be released and I proposed that we turn off check-in notifications and sneak in a "this.py" module which when imported just printed the Zen of Python.
There's a file called this.py
in the Lib directory.
The string is encoded using ROT-13 so it's not searchable. The code to decode it is in the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With