Using concurrent.futures to Run Code Concurrently

The concurrent.futures module provides a unified high-level interface over both Thread and Process objects (so you don’t have to use the low-level interfaces in threading and process).

While concurrent.futures may not be able to run code concurrently in all the ways that you’d expect based on reading the underlying threading and multiprocessing modules, concurrent.futures is a great place to start. It exposes an approachable interface for executing code under threads and processes and gives you the power to run code concurrently without needing to get into the grittiest details of concurrent programming. If you can write a function in Python, you can use concurrent.futures.

The two most important ...

Get Intuitive Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.