On 11:24 am, p.may...@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 inlineCallbacks. 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. Jean-Paul >If not, would that behaviour be desirable? It seems >like it would be a useful pattern to me. > >_______________________________________________ >Twisted-Python mailing list >Twisted-Python@twistedmatrix.com >http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python