[Twisted-Python] defer.inlineCallbacks dosn't work with cython, deferredGenerator does.
dynamicgl at gmail.com
Mon Apr 9 06:05:41 EDT 2012
I just to let you know that defer.inlineCallbacks can't work with cython
well. an example:
d = defer.Deferred()
reactor.callLater(3, d.callback, True)
thing = yield await()
will fail to work on cython due to cython would change the function
name(here I refer to host()) which lead to generator can't send back the
result to the original function.
However, deferredGenerator does work with cython
d = await()
thing = defer.waitForDeferred(d)
It is not a common case to write such codes with cython, in case of need,
deferredGenerator may help.
I personally hope deferredGenerator will be always there even python 2.4
support has been abandoned. deferredGenerator itself is not so elegant as
inlineCallbacks, at least I don't need
to struggle with a series of callback functions..
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python