N
nyoka
Can someone help me with sample python code for a code generator
Can someone help me with sample python code for a code generator
nyoka said:Can someone help me with sample python code for a code generator
nyoka said:Can someone help me with sample python code for a code generator
Sure, here are some example of self-evaluating python objects, i.e. for
each v
below,
v == eval(v)
I'm quite proud of the last one.
If you're proud of the last one, consider moving to Perl. Python is - asSure, here are some example of self-evaluating python objects, i.e. for each v
below,
v == eval(v)
I'm quite proud of the last one.
v = (lambda x:x%('"''""'+x+'"''""'))("""(lambda x:x%%('"''""'+x+'"''""'))(%s)""")
v = (lambda x:x%('r\"'+x+'\"'))(r"(lambda x:x%%('r\"'+x+'\"'))(%s)")
v = (lambda x:x%`x`)('(lambda x:x%%`x`)(%s)')
v = (lambda x: x+"("+`x`+")")('(lambda x: x+"("+`x`+")")')
v = "\"%s\" %% ((r\"%s\",)*2)" % ((r"\"%s\" %% ((r\"%s\",)*2)",)*2)
trzewiczek said:On 01/13/2010 05:09 PM, Arnaud Delobelle wrote: [...]If you're proud of the last one, consider moving to Perl. Python is -Sure, here are some example of self-evaluating python objects,
i.e. for each v below,
v == eval(v)
I'm quite proud of the last one. [...]
v = "\"%s\" %% ((r\"%s\",)*2)" % ((r"\"%s\" %% ((r\"%s\",)*2)",)*2)
as I heard - about elegance and readability of code...
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.