Skip to content

Instantly share code, notes, and snippets.

@Ouwen
Created September 3, 2019 19:58
Show Gist options
  • Save Ouwen/4d9f6f0d963757761b9fa526054d42db to your computer and use it in GitHub Desktop.
Save Ouwen/4d9f6f0d963757761b9fa526054d42db to your computer and use it in GitHub Desktop.
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