[PyAR2] Obfuscated Python!

Greg Lindstrom gslindstrom at gmail.com
Fri Jun 24 16:20:58 CEST 2011


Ok.  It IS possible to write obfuscated code in Python, especially when you
use "lambda" functions.  This little ditty writes out one of my (and, I
hope, your) favorite mathematical constants in just a couple seconds (on my
machine).  This is not my doing; it was posted on the Python list.  Can you
figure out how it does what it does?

--greg

print((lambda f:((lambda p:p[0]+'.'+p[1:])(str((lambda Q:2*Q[0]*Q[0]//Q
[3])((lambda F:(lambda S:f(lambda T,_:((T[0]+T[1])//2,S((T[0]*T[1])//
F),2*T[2],(T[3]-(T[2]*(((T[0]+T[1])//2)**2-(S((T[0]*T[1])//F))**2))//F)),
[0]*13,(F,(F*F)//S(2*F),2,F//2)))(lambda n:f(lambda x,_:(x-x//2+(n*F)//
(2*x)),[0]*15,n//2)))(10**(5010))))[:5000])))(reduce))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/mailman/private/pyar2/attachments/20110624/6525f376/attachment.html>


More information about the PyAR2 mailing list