Thread vs. generator problem

Paul Rubin http
Fri May 26 20:21:12 EDT 2006


"Tim Peters" <tim.peters at gmail.com> writes:
> >     g = remote_iterate(itertools.count)
> 
> You didn't run this code, right?  itertools.count() was intended.

Sorry, I made a cut-and-paste error posting the message.  My test case
did use itertools.count().

> In any case, as when calling any generator, nothing in the body of
> remote_iterate() is executed until the generator-iterator's next()
> method is invoked.  

Ooof, I see what happened now.  My first test case was misleading and
made me think that the generator immediately executed until it reached
a yield statement.  In fact it was the generator function (i.e. the
thing that made the generator), a separate object, that printed the
messages.

Thanks!



More information about the Python-list mailing list