Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from concurrent.futures import ThreadPoolExecutor, as_completed
- def work(arg):
- """do work here"""
- pass
- def main():
- args =["initial", "arguments"]
- with ThreadPoolExecutor(max_workers=10) as executor:
- futures = [executor.submit(work, arg, "optional", "arguments") for arg in args]
- result = [future.result() for future in as_completed(futures)]
Add Comment
Please, Sign In to add comment