from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks, returnValue, Deferred @inlineCallbacks def inline1(): d = Deferred() reactor.callLater(1, d.callback, 1) result = yield d print 'inline1', result result = inline2() print 'inline2', result @inlineCallbacks def inline2(): d = Deferred() reactor.callLater(2, d.callback, 2) result = yield d returnValue(result) reactor.callWhenRunning(inline1) reactor.run()
Выводит почему-то
inline1 1
inline2 <Deferred at 0xb727d9ecL>