Python 3.2+concurrent.futuresterm
concurrent
module
A package for parallel execution: thread and process pools in concurrent.futures.
Syntax
from concurrent.futures import ThreadPoolExecutor
The package consists of submodules: concurrent.futures provides ThreadPoolExecutor and ProcessPoolExecutor behind a common Executor interface, and Python 3.14 added concurrent.interpreters for multiple interpreters in one process. You almost always want concurrent.futures: threads for waiting on I/O, processes for computation that threads cannot speed up because of the GIL. Its Future is not the same as asyncio.Future, which serves coroutines.
Examples
from concurrent.futures import ThreadPoolExecutor
with ThreadPoolExecutor(max_workers=2) as pool:
results = list(pool.map(len, ['a', 'bb', 'ccc']))
print(results) # → [1, 2, 3]
See also
Open in the full glossarydocs.python.orgReport an inaccuracy