Just a small quine

Jonathan Gardner gardner at cardomain.com
Sat Jun 9 23:58:06 EDT 2001


Gerson Kurz wrote:

> On Fri, 8 Jun 2001 18:27:58 +0200, Pieter Nagel <pieter at equinox.co.za>
> wrote:
> 
>>Small? Here's a one-line quine:
>>
>>s="s=%c%s%c; print s%%(34,s,34)"; print s%(34,s,34)
>>
> 
> note about my first one: the stuff at the top defines a brainf*ck
> interpreter, the stuff at the bottom creates sourcecode for the
> interpreter and then calls it... but its still python ;)
> 
> here are two other quines I wrote while brewing up that one:
> 
> def r(x):x=list(x);x.reverse();return "".join(x)
> s="""
> s tnirp;]:05[)s(r+)01(rhc+'"'*3+s+'"'*3+]25:[)s(r=s
> )x(nioj."" nruter;)(esrever.x;)x(tsil=x:)x(r fed
> """
> s=r(s)[:52]+3*'"'+s+3*'"'+chr(10)+r(s)[50:];print s
> 
> and
> 
> s="""s="s="+3*'"'+s+3*'"'+chr(59)+s
> print s""";s="s="+3*'"'+s+3*'"'+chr(59)+s
> print s
> 
> both use the same basic idea so its kind of a downer once you see
> whats happening.

Are we going to start signing our posts with quines, the same way that the 
Perl people sign their posts with JAPH? 






More information about the Python-list mailing list