Not sure I fully get it:

Twisted's `inlineCallback` use regular raise for exceptions, but a special
`returnValue` function for returning

https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/slowsquare/server.py#L36

Is that a third alternative? [not a rhetorical question! ;)]

No, that function raises an exception. The disadvantage (in my mind)
over just using a raise statement is that the control flow is clear to
even the dumbest "static analysis" code (like Emacs' python-mode).

Ahh. Yes.

http://twistedmatrix.com/trac/browser/tags/releases/twisted-13.2.0/twisted/internet/defer.py#L1063

[Sorry, I should have had a look into `returnValue` myself ..]

It's just sugered up in Twisted .. and one could simply do

def returnValue(value):
   raise asyncio.Result(value)

on top of Trollius.

But I agree on the control flow thing.

Thanks again,

/Tobias

Reply via email to