[Twisted-Python] Giving inlineCallbacks-wrapped functions access to the deferred their wrapper will return

Terry Jones terry at jon.es
Sun Apr 12 07:52:17 EDT 2009

>>>>> "glyph" == glyph  <glyph at divmod.com> writes:
glyph> When I write functions that take a Deferred I typically have them
glyph> return a Deferred as well, to avoid this, and other syntactic
glyph> nuisances.  Would you consider the following more elegant?

Yes. And thanks for the rule of thumb.

In any case, I realized that my original idea wont work. _inlineCallbacks
returns the deferred to the caller of the wrapped function early. The
caller could add callbacks to it before the wrapped function does, which
makes the whole idea unworkable.


More information about the Twisted-Python mailing list