python vs. perl readability

Anton Muhin antonmuhin at sendmail.ru
Thu Mar 6 11:46:35 EST 2003


Hilbert wrote:
> Hello,
> 
> A friend of mine uses perl at work, I'm converting
> to python. I've showed him a couple of times how
> much easier it is to read python code than perl, but
> last night he sent me this:
> (I know it's ajoke, just wanted to share...)
> 
> 
> -------
> import sys
> 
> z,x,y= "}{|}A|k{|kA|}=BE1)|BF}))|$}:~pI~/;@Go{H%{&A?|if }:~pJ"\
>        "IJ-1~#>=0:GoAG at HG;o{G;%-I&{?|m,kJ,j=C?;/@~o{~D:Gl[c]("\
>        ")?","G$p:%~;%~;el!]':p%break~;![':p%#<len(j):~%\n\t\t"\
>        "%if c=='%while o%\n%m[k]%+=1%\t%if not %c=j[o]%-=1%sy"\
>        "s.std%[0]*64000,0,0,open(sys.argv[1]).read()%if l.has"\
>        "_key(c)%in.read(%out.write(chr(%=1%,o".split('%'),"HG"\
>        "&%/~!#?}{;$@ABCDEFIJ"
> 
> for i in range(len(x)):z=z.replace(y[i],x[i])
> z=z.split('|')
> for o in range(9):
>     exec("def %c():\n\tglobal k,m,o,j\n\t%s\n"%(chr(97+o),z[o]))
> l={'>':c,'<':d,'-': b,'+':a,',':e,'.':f,'[':g,']':h}
> i()
> ------------------------------
> 
> 
> Hilbert
> 
> 


Another recipe:

1. Write some small script in Python.
2. zip it.
3. Convert into string.
4. Place this string into new script.
5. Unzip it and call eval.

Anton.





More information about the Python-list mailing list