-
-
Save tristanwietsma/7ab25ca7e654cc60be46 to your computer and use it in GitHub Desktop.
Futures example with multiple input params
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
from concurrent.futures import ProcessPoolExecutor | |
def myfunc(a, b, c): | |
return a + b + c | |
if __name__ == '__main__': | |
workers = 3 | |
result = [] | |
with ProcessPoolExecutor(max_workers=workers) as executor: | |
for i in range(10): | |
result.append(executor.submit(myfunc, i, i*2, i*3)) | |
for r in result: | |
print(r.result()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment