Created
July 2, 2020 18:55
-
-
Save hamelsmu/95d372937f4df32c9e73b8ccb423ff1b 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
from multiprocessing import Pool | |
from time import sleep | |
def f(x): | |
sleep(1000) # simulate some computation | |
return x*x | |
if __name__ == '__main__': | |
with Pool(8) as p: | |
print(p.map(f, range(8))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment