# Add hint of duration for each iteration in tqdm

I have a list of tasks that each take a different amount of time. Let's say, I have 3 tasks, with durations close to 1x, 5x, 10*x. My tqdm code is something like:

``````from tqdm import tqdm

def fib(x):
if x == 1 or x == 0:
return 1
return fib(x - 1) + fib(x - 2)
return lambda: fib(n)

n = 1
``````

The problem is that tqdm thinks each iteration takes the same amount of time. As the first takes approximately 1/10 of the time, the ETA is unreliable.

My question: is it possible to somehow add a hint to tqdm to inform how much each iteration takes compared to the first? Something like informing the duration weights of each iteration...

Thanks!

If "create_task" can be modified, the "inspect" library can help.

``````import time
from tqdm import tqdm
from inspect import currentframe,getargvalues

'''
On my computer, "tqdm" cannot handle the Fibonacci sequence.
'''
# def fib(x):
#     if x == 1 or x == 0:
#         return 1
#     return fib(x - 1) + fib(x - 2)
def func(x):
time.sleep(x)
return lambda: func(n), getargvalues(currentframe()).locals['n']

n = 1