1
\$\begingroup\$

This question already has an answer here:

I wrote this one-line one-statement Python quine a little while back.

print (lambda x: x + str((x,)))('print (lambda x: x + str((x,)))',)

The point is, it's all one line, and one function (i.e. no semicolons). Does anyone have a shorter one like this?

Note: of course there's the empty file, but that's not what I mean. And, no reading the source file either, &c. Also, just to say explicitly, a quine of the type r='r=%r;print r%%r';print r%r from The Quine Page is multiple statements, so while it's cool, it isn't what I'm talking about here. (:

\$\endgroup\$

marked as duplicate by William Barbosa, Peter Taylor, Martin Ender, manatwork, Justin Sep 12 '14 at 14:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    \$\begingroup\$ I don't think so. I'm looking for a quine that doesn't use multiple statements. the ones in that post are multiple statements, like the example I gave. \$\endgroup\$ – postylem Sep 12 '14 at 12:46
  • 1
    \$\begingroup\$ Not true. There's a single statement 54-char Python quine in that thread. \$\endgroup\$ – Peter Taylor Sep 12 '14 at 12:49
  • \$\begingroup\$ isn't it the winning python entry this: _='_=%r;print _%%_';print _%_? that's multiple statements right? \$\endgroup\$ – postylem Sep 12 '14 at 12:52
  • \$\begingroup\$ @postylem no this one: codegolf.stackexchange.com/a/25407/8478 \$\endgroup\$ – Martin Ender Sep 12 '14 at 12:53
  • \$\begingroup\$ Yours can be shortened to print(lambda x:x+`(x,)`)('print(lambda x:x+`(x,)`)',) \$\endgroup\$ – flornquake Sep 12 '14 at 12:54

Browse other questions tagged or ask your own question.