Re: Restart generator when it is exhausted.

2009-04-29 Thread Lacrima
On Apr 28, 6:38 pm, "J. Cliff Dyer" wrote: > On Tue, 2009-04-28 at 10:41 +, Duncan Booth wrote: > > Lacrima 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

Re: Restart generator when it is exhausted.

2009-04-28 Thread J. Cliff Dyer
On Tue, 2009-04-28 at 10:41 +, Duncan Booth wrote: > Lacrima 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 > woul

Re: Restart generator when it is exhausted.

2009-04-28 Thread Duncan Booth
Lacrima 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

Re: Restart generator when it is exhausted.

2009-04-28 Thread Lacrima
On Apr 28, 1:04 pm, Chris Rebert wrote: > On Tue, Apr 28, 2009 at 2:54 AM, Lacrima wrote: > > Hello! > > > I am quite new to Python and I have maybe simple (or maybe not) > > question. > > > Is it possible to restart generator when it is exhausted? > > No. You have to make a new instance of the g

Re: Restart generator when it is exhausted.

2009-04-28 Thread Chris Rebert
On Tue, Apr 28, 2009 at 2:54 AM, Lacrima wrote: > Hello! > > I am quite new to Python and I have maybe simple (or maybe not) > question. > > Is it possible to restart generator when it is exhausted? No. You have to make a new instance of the generator. > What should I do to get the initial state