Python self-evaluating strings
Terry Reedy
tjreedy at udel.edu
Mon Jan 28 22:48:11 EST 2008
"Arnaud Delobelle" <arnodel at googlemail.com> wrote in message
news:a04ca850-fe63-4b7e-abff-cdacab3bcc0f at i29g2000prf.googlegroups.com...
| I found this:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a1316cb4e216eba4/0cda739385abd03c?lnk=gst&q=Self-Reproducing+Program#0cda739385abd03c
Exactly the one I meant.
| It contains a lambda-solution similar to mine, only more concise:
| (lambda x:x%`x`)('(lambda x:x%%`x`)(%s)')
Being a Lisp novice, I was rather proud of that translation
| I have been using python for 7 years, and it the first time ever that
| I see the `...` construct being used!
It is going away in 3.0, so the above would need revision to work with
repr(), if indeed it will.
| Thanks
You're welcome
Terry
More information about the Python-list
mailing list