The multiprocessing.pool.ThreadPool behaves the same as the multiprocessing.Pool with the only difference that uses threads instead of processes to run the workers logic.
Here is what the above code is Doing:
1. We create a ThreadPool with 4 threads.
2. We map the function to the list of items.
3. We close the pool.
4. We wait for the pool to finish.
5. We print the results.