Skip to content

Instantly share code, notes, and snippets.

@binki
Created November 27, 2018 02:56
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 binki/6839968fb11affdf9eb36bd6e3d4b81f to your computer and use it in GitHub Desktop.
Save binki/6839968fb11affdf9eb36bd6e3d4b81f to your computer and use it in GitHub Desktop.
Python function binding
#!/usr/bin/env python
def my_func(x):
print(x)
def build_my_func_call(x):
def f():
my_func(x)
return f
funcs = [
build_my_func_call('a'),
build_my_func_call('b'),
]
for f in funcs:
f()
funcs.reverse()
for f in funcs:
f()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment