Skip to content

Instantly share code, notes, and snippets.

@tristanwietsma
Created June 6, 2014 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tristanwietsma/7ab25ca7e654cc60be46 to your computer and use it in GitHub Desktop.
Save tristanwietsma/7ab25ca7e654cc60be46 to your computer and use it in GitHub Desktop.
Futures example with multiple input params
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