Thanks Kent. That is what i did the first time around but it
didn't
work ...
but that was do to something else that was not working in
the script....
hehe.... of course, this just shuffles the saved copy of the
list which
is
egg-zactly what i needed "duh" ... sorry...
gosh... <red face=on>
-kevin--
On Apr 27, 2006, at 6:00 AM, tutor-request python.org wrote:
> 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
|