Skip to content

Instantly share code, notes, and snippets.

@asvetlov
Last active August 29, 2015 14:19
Show Gist options
  • Save asvetlov/b33fa82618767b9ed82f to your computer and use it in GitHub Desktop.
Save asvetlov/b33fa82618767b9ed82f to your computer and use it in GitHub Desktop.
def f():
future = asyncio.Future()
future.set_result(5)
return future # yield from f() returns 5.
def g():
future = asyncio.Future()
asyncio.get_event_loop.call_later(1, future.set_result, 5)
return future # yield from g() also returns 5 but 1 second later
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment