Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joonro/fc721bb4743f147ffc9c366600d4ad9b to your computer and use it in GitHub Desktop.
Save joonro/fc721bb4743f147ffc9c366600d4ad9b to your computer and use it in GitHub Desktop.
[Freeze a function with a function argument with partial] I guess it should work, but I can freeze a function with function arguments as well. https://docs.python.org/3/library/functools.html#functools.partial #python #multiprocessing
# test partial
from functools import partial
def frozen_func():
return 2
def target_func(x, frozen_func):
return x + frozen_func()
test_partial = partial(target_func, frozen_func=frozen_func)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment