
April 12, 2009
12:40 a.m.
On 11 Apr, 10:55 pm, terry@jon.es wrote:
I can get around this in ways that are less elegant:
@defer.inlineCallbacks def func(): # do some stuff d = defer.Deferred() callSomethingElse(d) d.callback(result) newResult = yield d defer.returnValue(newResult)
When I write functions that take a Deferred I typically have them return a Deferred as well, to avoid this, and other syntactic nuisances. Would you consider the following more elegant? @inlineCallbacks def func(): # do some stuff returnValue(yield callSomethingElse(succeed(result)))