Question regarding cur_batch in the data generator function

Is there some reason you reset the cur_batch at the end (after the yield) when the second line of the function initializes it as an empty list? I would think this wouldn’t be needed as the next time it’s called, it is reset. However I could be wrong, being relatively new to generators.

        # reset the current batch to an empty list
        cur_batch = []

After playing with generators, I noticed that it does need to be reset each time. I was thinking the function is called each time next is run but this is not the case. Never mind my question.