Is it possible to use tornado's gen.engine and gen.Task with twisted?

前端 未结 3 495
北海茫月
北海茫月 2021-01-21 16:03

The project I am working on is all written in Tornado, but I have included a bit of Twisted to deal with asynchronous XML-RPC. I was wondering if you can use Tornado\'s gen.engi

3条回答
  •  逝去的感伤
    2021-01-21 16:35

    Sure - but it's called inlineCallbacks in Twisted:

    from twisted.internet.defer import inlineCallbacks
    
    @inlineCallbacks
    def foo():
        x = yield bar()
        print x
    

提交回复
热议问题