Lacrima <lacrima.ma...@gmail.com> wrote:

> If it is not possible what are common techniques to use iterator or
> generator objects that allow restarting when it is needed?

The usual thing if you want to use the generator's output more than once  
would be to convert the generator to a list, then you can iterate over it 
as often as you want.

>>> a = ['a', 'b', 'c']
>>> g = (i for i in a)
>>> restartable = list(g)

If you want the output of the generator to potentially change each time you 
iterate then you need to create a new generator.

-- 
Duncan Booth http://kupuguy.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to