[Twisted-Python] t.i.task.Cooperator & inlineCallbacks mashup

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Wed Nov 2 09:08:42 EDT 2011

On 11:24 am, p.mayers at imperial.ac.uk wrote:
>I only just noticed today that if a generator passed to a
>CooperativeTask does:
>   result = yield some_deferred()
>...it doesn't work, because CooperativeTask doesn't .send() the result
>of the deferred bacn into the generator.
>Is this intentional?

Yes.  Cooperator is for iterators, not generators, making send unusable 
in the general case.  Cooperator also isn't a replacement for 

You can build a wrapper for a generator that works together with 
Cooperator and sends results back in.  If it ends up being useful, it 
might be something to add to Twisted.

>If not, would that behaviour be desirable? It seems
>like it would be a useful pattern to me.
>Twisted-Python mailing list
>Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list