Skip to content

Instantly share code, notes, and snippets.

@kived
Created September 16, 2015 20:30
Show Gist options
  • Save kived/c735333d2f8e57393501 to your computer and use it in GitHub Desktop.
Save kived/c735333d2f8e57393501 to your computer and use it in GitHub Desktop.
Twisted: inline callbacks vs normal Python function
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