In this lesson, you’ll see why you’d want to take this approach. Because you wrote your code in a functional programming style, you can parallelize it fairly easily. There’s a parallel map
construct that you can use. That way, you can run your processing steps in parellel.
You’ll import the multiprocessing
module because it has all the building blocks you’ll need to run this operation in parallel. Later, you’ll learn how to use the multiprocessing.Pool
class and its parallel map
implementation, which makes parallelizing most Python code that’s written in a functional style a breeze.