Easter Eggs

Duncan Booth duncan at NOSPAMrcp.co.uk
Wed Apr 10 05:12:15 EDT 2002


Kalle Svensson <kalle at gnupung.net> wrote in 
news:mailman.1018391839.6535.python-list at python.org:

> [Lulu of the Lotus-Eaters]
>> Who can tell me what's in there.  Someone on c.l.py recently let drop
>> the hint about finding the Zen of Python at the interactive prompt in
>> 2.2.  I went so far as trying the command in Python versions 1.51, 1.52,
>> 2.0, 2.1, 2.2 (it's only in 2.2)... but then promptly forgot what the
>> magic command was.  Can someone remind me, please?
> 
> "import this", IIRC.
> 
The code that in this.py is a terrible advert for Python though. 
It does:
   d = {}
   for c in (65, 97):
       for i in range(26):
           d[chr(i+c)] = chr((i+13) % 26 + c)

   print "".join([d.get(c, c) for c in s])

when all it actually needs is:
   print s.decode('rot13')

Patch submitted to sourceforge.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list