Skip to content

Instantly share code, notes, and snippets.

@nemosupremo
Last active April 1, 2019 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nemosupremo/4ed70df5095ca919a178f67b759b74c2 to your computer and use it in GitHub Desktop.
Save nemosupremo/4ed70df5095ca919a178f67b759b74c2 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
def a():
print('a')
def b():
print('b')
def c():
print('c')
funcs = []
for f in [a,b,c]:
def fg():
f()
funcs.append(fg)
funcs[0]()
funcs[1]()
funcs[2]()
# Output:
# c
# c
# c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment