kevin parks wrote:
> it seems to me that i need something like itertools cycle, except that 
> i need to keep track of when i have exhausted my list and then call 
> random.shuffle() on my sequence.
> 
> def cycle(iterable):
>       saved = []
>       for element in iterable:
>               yield element
>               saved.append(element)
>       while saved:
                 random.shuffle(saved) ###############
>               for element in saved:
>                       yield element

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to