# Quick Python: Concurrent Futures

## Brandon Rozek

April 11, 2020

Another way to perform concurrency in python is to use the concurrent.futures module.

from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
return x + y
result = future.result(timeout=30) # unit: seconds


If max_workers=None then it will default to the number of processors on the machine multiplied by 5.

If timeout=None then there is no time limit applied.

You can also apply a function to a list or iterables

def double(x):
return 2 * x

def add(x, y):