Python self-evaluating strings
Arnaud Delobelle
arnodel at googlemail.com
Sun Jan 27 19:17:18 EST 2008
On Jan 27, 11:58 pm, "Terry Reedy" <tjre... at udel.edu> wrote:
> "Arnaud Delobelle" <arno... at googlemail.com> wrote in message
> Some years ago there was a substantial thread on this, (Shortest
> Self-Reproducing Programs, or some such) including a fairly long one from
> me that gave several 'shortest' (depending of definition and input method).
> It included a Python tranlation of at least one standard Lisp version. I
> presume you could find it on groups.google
I found this:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a1316cb4e216eba4/0cda739385abd03c?lnk=gst&q=Self-Reproducing+Program#0cda739385abd03c
It contains a lambda-solution similar to mine, only more concise:
(lambda x:x%`x`)('(lambda x:x%%`x`)(%s)')
I have been using python for 7 years, and it the first time ever that
I see the `...` construct being used! In fact I didn't even remember
that it existed (I'm not even sure that I've ever known about it...)
Thanks
--
Arnaud
More information about the Python-list
mailing list