2

I found this answer (https://stackoverflow.com/a/59905309/7462275) to display a progress bar very very simple to use. I would like to use this simple solution for functions that take many arguments.

Following, the above mentioned answer, I write this code that works :

from tqdm.contrib.concurrent import process_map
import time

def _foo(my_tuple):
    my_number1, my_number2 = my_tuple
    square = my_number1 * my_number2
    time.sleep(1)
    return square 

r = process_map(_foo, [(i,j) for i,j in zip(range(0,30),range(100,130))],max_workers=mp.cpu_count())

But I wonder, if it is the correct solution (using a tuple to assign function variable) to do that. Thanks for answer

Stef1611
  • 1,978
  • 2
  • 11
  • 30

0 Answers0