Skip to content

Instantly share code, notes, and snippets.

@kidd
Created March 1, 2022 18:21
Show Gist options
  • Save kidd/14c128276ff8ad0b0d71bee57e39f954 to your computer and use it in GitHub Desktop.
Save kidd/14c128276ff8ad0b0d71bee57e39f954 to your computer and use it in GitHub Desktop.
from multiprocessing import Pool
import functools
import time
def f(i, x):
time.sleep(x)
print(i, x)
if __name__ == '__main__':
ff = functools.partial(f, "hola")
with Pool(4) as p:
print(p.map(ff, [1,3,4,2]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment