Created
June 23, 2021 15:45
-
-
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
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
# 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