On 11 Apr, 10:55 pm, te...@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)))

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to