To make my code more \"pythonic\" and faster, I use \"multiprocessing\" and a map function to send it a) the function and b) the range of iterations.
The implanted s
This approach simple and it works.
from multiprocessing.pool import ThreadPool import time from tqdm import tqdm def job(): time.sleep(1) pbar.update() pool = ThreadPool(5) with tqdm(total=100) as pbar: for i in range(100): pool.apply_async(job) pool.close() pool.join()