Skip to content

Instantly share code, notes, and snippets.

@fcostin
Created March 18, 2010 04:57
Show Gist options
  • Save fcostin/336062 to your computer and use it in GitHub Desktop.
Save fcostin/336062 to your computer and use it in GitHub Desktop.
first attempt at a python3 quine
b = ['b = ', "print('%s' % str(x[0]), end='')", '\n', 'def f(*x): eval(b[1]) if type(x[0]) is str else [g(s) for s in x]', "def g(x): print('f(b[%d])' % x if type(x) is int else 'f(%s)' % x)", "0, 'b', 4, 2, 3", '2, b[5], b[6]']
def g(x): print('f(b[%d])' % x if type(x) is int else 'f(%s)' % x)
def f(*x): eval(b[1]) if type(x[0]) is str else [g(s) for s in x]
f(b[0])
f(b)
f(b[4])
f(b[2])
f(b[3])
f(b[2])
f(0, 'b', 4, 2, 3)
f(2, b[5], b[6])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment