John Posner <jjpos...@snet.net> wrote:
> 
> [snip]
> > > If you want next(g) to yield 3, you'd have to do something like:
> > > 
> > >     g = (x for x in s[:])
> > > 
> > > where s[:] makes a copy of s that is then iterated over.
>  
> 
> BTW, this simpler statement works, too:
> 
>    g = iter(s[:])

Yes, but one presumes that in the real code that prompted the OP's
question he wasn't just returning 'x'.

--
R. David Murray           http://www.bitdance.com

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to