Paul Rubin a écrit : > > As Bruno says, you can use itertools.cycle, but the problem above is > that you're not looping repeatedly through the list; you yield all the > elements, then yield the first element again, then stop. So for > ['a','b','c'] you'd yield the sequence a,b,c,a.
Yes, that was the problem. Thanks for the explanation and for the cycle() function from itertool that I missed. -- http://mail.python.org/mailman/listinfo/python-list