In the described situation, I myself use the @StephenRauch method. But, given that you added cycle as a tag, you may know that there is such a thing as itertools.cycle .
It returns an iterator so that you can cycle through iterable cyclically. I do not know your original problem, but you may find it useful.
import itertools for i in itertools.cycle([1, 2, 3]):
Be careful with exit conditions, but you may end up in an endless loop.
Rockybilly
source share