I'd like to implement a simple round robin over a Python list or set that may be changed at runtime. The Problem is that I have a set of tasks that are to be executed in a round robin fashion, which should be simple enough to implement with a list and a modular increment of the index, but since I will modify the list it gets a bit more complex.
Any good solution in Python, so I don't have to reinvent the wheel?
I once used for testing purposes a "round-robin" test-object generator. I don't know if this will help you, but i included a simple example script to demsonstrate how it operates.
from itertools import cycle
n = 1
lst = [n]
for i in cycle(lst):
print i
n += 1
if n < 100:
lst.append(n)