Skip to content

Instantly share code, notes, and snippets.

@nizox
Created August 31, 2012 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nizox/3561289 to your computer and use it in GitHub Desktop.
Save nizox/3561289 to your computer and use it in GitHub Desktop.
>>> def a(order):
... todo = []
... for i in order:
... def g(i):
... return lambda x: x[i]
,,, todo.append(g(i))
... def b(x):
... return [do(x) for do in todo]
... return b
>>> b = a([2, 0, 1])
>>> b(["a", "b", "c"])
<<< ['b', 'b', 'b']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment