[Twisted-Python] deferred folies

Christopher Armstrong radix at twistedmatrix.com
Tue Sep 30 14:45:06 EDT 2003

On Tue, Sep 30, 2003 at 06:27:43PM +0200, Federico Di Gregorio wrote:
> now, for a simple get session/execute/end sequence i don't want to write
> n+1 callbacks (one that waits for new_session and call execute, next one
> that wait on execute and call next, etc.) so here is what I did (inside
> a mixin class used in the client):

If you _really_ want to try avoiding all the callbacks, I think your
hack is the wrong way to do it. Use something like twisted.flow's
Deferred support: this way, you "yield" when you wait for a Deferred
to fire, and then you will be able to get the result synchronously
once your function is returned. There's probably an example somewhere
in the flow docstrings or examples.

 Twisted | Christopher Armstrong: International Man of Twistery
  Radix  |          Release Manager,  Twisted Project
---------+     http://twistedmatrix.com/users/radix.twistd/

More information about the Twisted-Python mailing list