Guest User

Untitled

a guest
Oct 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. from concurrent.futures import ThreadPoolExecutor, as_completed
  2.  
  3. def work(arg):
  4. """do work here"""
  5. pass
  6.  
  7. def main():
  8. args =["initial", "arguments"]
  9. with ThreadPoolExecutor(max_workers=10) as executor:
  10. futures = [executor.submit(work, arg, "optional", "arguments") for arg in args]
  11.  
  12. result = [future.result() for future in as_completed(futures)]
Add Comment
Please, Sign In to add comment