When we worked with the concurrent.futures module in Chapter 6, Parallel Processing, we saw a way to make two or more streams of code run at the same time. For reference, have a look at the code example we used in the previous chapter:
This code helps you create an executor object. Now if you ever wish to run some code in parallel, you could just tell the executor to do it. The executor would give us a future object that we could use later to get the result of the code, and it would then run the code in a separate process. Our original code will keep on running in the original process.
We talked about how this could improve the performance of CPU-bound programs—it divides the code into multiple computer cores. Therefore, it's a technique that would be convenient in a lot of other circumstances...