()
return elapsed, progress
Prints progress on inserting elements.
Prints progress on inserting elements.
Prints progress on inserting elements .
def timer_func():
    """
    Prints progress on inserting elements.
    """

    last = time.time()

    def elapsed(msg):
        nonlocal last
        now = time.time()
        sec = round(now - last, 1)
        last = now
        print(f"{msg} in {sec} seconds")

    def progress(index, step=5000, msg=""):
        nonlocal last
        if index % step == 0:
            elapsed(f"... {index} {msg}")

    return elapsed, progress
def timer_func ( ) : last = time . time ( ) def elapsed ( msg ) : nonlocal last now = time . time ( ) sec = round ( now - last , 1 ) last = now print ( f"{msg} in {sec} seconds" ) def progress ( index , step = 5000 , msg = "" ) : nonlocal last if index % step == 0 : elapsed ( f"... {index} {msg}" ) return elapsed , progress