In the spirit of "Simple is better than complex." and totally
bypassing the intention of quines (though not necessarily the
definition):
--- probably_not_a_real_quine.py
import sys
for line in open(sys.argv[0]):
print line,
--
;-)
--
Ant.
--
http:/
On Jan 29, 3:48 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> | I found
> this:http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>
> Exactly the one I meant.
>
> | It contains a lambda-solu
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| 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 lamb
On Jan 27, 11:58 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Arnaud Delobelle" <[EMAIL PROTECTED]> 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' (
On Jan 27, 4:14 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
[...]
> 1. Starting from the classic idea (lambda x:x%x)('lambda x:x%x') I got
> the following
> v=(lambda x:x%('"''""'+x+'"''""'))("""(lambda x:x%%('"''""'+x+'"''""'))
> (%s)""")
A bit more readable:
v1=(lambda x:x%('r\"'+x+'\"'))
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| An earlier post today got me thinking about "quines" (programs that
| output themselves) in Python. I tried to find some on the web but
| didn't find many ([1]). In particular I didn't find any that
| corresponded
Now there's always that style :
>>> print x
Traceback (most recent call last):
File "", line 1, in
eval(x)
File "", line 2
Traceback (most recent call last):
^
SyntaxError: invalid syntax
>>> eval(x)
Traceback (most recent call last):
File "", lin
It's a bit cheap, but how about
>>> from inspect import getsource
>>> print getsource(getsource)
or similarly
def f(g):
import inspect
return inspect.getsource(g)
print f(f)
Dan
--
http://mail.python.org/mailman/listinfo/python-list
Hi all,
An earlier post today got me thinking about "quines" (programs that
output themselves) in Python. I tried to find some on the web but
didn't find many ([1]). In particular I didn't find any that
corresponded to my instinctive (LISP-induced, probably) criterion:
def self_evaluating