[Twisted-Python] deferredGenerator or inlineCallbacks

Nitro nitro at dr-code.org
Mon Jan 14 22:03:37 EST 2008


> Note that you cannot
>
>     return result
>
> from within do_some_inline_callback_stuff(), because this is actually a
> generator now, since it contains a yield.

You can. Use the returnValue() function found in the same module as the  
inlineCallbacks decorator.

> This is quite neat stuff.. though it feels a bit sneaky and magical.

Yeah, I am using it a lot recently too. It's just so much better than all  
those backwards code with callbacks before your actual invokation of the  
function :)
I had the same problems as you btw, thinking about things backwards. Now  
everything makes sense and works :)

-Matthias






More information about the Twisted-Python mailing list