[Tutor] this module

Dave Angel davea at ieee.org
Sat Aug 8 15:51:36 CEST 2009


Mark Young wrote:
> Hi, I was reading a tutorial, and it mentioned the "import this" easter egg.
> I was curious, and looked up the contents of the module, and dscovered that
> it had attributes c, d, i, and s. I was wondering if anyone had any clue
> what these attributes were supposed to mean. I think (this.s) is the zen of
> python in some foreign language (dutch maybe?), but I have no clue what the
> significance of the others are. Just wondering if anyone knew, (or if they
> mean anything at all).
>
> Also, I was wondering, when a user first imports this, how does the module
> print the zen of python? I can't figure out how it does it.
>
>   
Each module runs when you import it.  So if there are print statements 
that are not either inside definitions, classes or conditionals, you'll 
see their output.

As for this.py, take a look at it.  The "dutch" is actually an encoding 
currently popularly referred to as ROT13, a substitution cipher where 
each letter is replaced by the one halfway (13 characters) around the 
alphabet.  If you look at d, you'll see it's a dictionary with the 
mapping between 'a' and 'o', 'b' and 'p', and so on.

DaveA


More information about the Tutor mailing list