Created
September 3, 2019 19:58
-
-
Save Ouwen/4d9f6f0d963757761b9fa526054d42db to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def partial(fn, *fargs, **fkwargs): | |
def wrapper_fn(*args, **kwargs): | |
return fn(*fargs, *args, **fkwargs, **kwargs) | |
return wrapper_fn | |
def function_with_several_params(a='None', b='None'): | |
print(a, b) | |
tmp_fn = partial(function_with_several_params, a='hello') | |
# Execute some other code | |
tmp(b='goodbye') # will execute like normal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment