Created
September 16, 2015 20:30
-
-
Save kived/c735333d2f8e57393501 to your computer and use it in GitHub Desktop.
Twisted: inline callbacks vs normal Python function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def my_function(): | |
res1 = do_long_stuff_one() | |
res2 = do_long_stuff_two(res1) | |
return res2 | |
@defer.inlineCallbacks | |
def my_function(): | |
res1 = yield do_long_stuff_one() | |
res2 = yield do_long_stuff_two(res1) | |
defer.returnValue(res2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment