Last active
April 1, 2019 21:04
-
-
Save nemosupremo/4ed70df5095ca919a178f67b759b74c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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