Skip to content

Instantly share code, notes, and snippets.

@mattrasband
Created September 28, 2016 01:42
Show Gist options
  • Save mattrasband/62d92e6c53c549b3075695566a60c1ed to your computer and use it in GitHub Desktop.
Save mattrasband/62d92e6c53c549b3075695566a60c1ed to your computer and use it in GitHub Desktop.
import asyncio
@asyncio.coroutine
def first_async_function():
yield from asyncio.sleep(2.5)
return 'Result found!'
async def new_async_function():
res = await first_async_function()
print('result from other async function:', res)
loop = asyncio.get_event_loop()
loop.run_until_complete(new_async_function())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment