Skip to content

Instantly share code, notes, and snippets.

@chaudum
Created June 18, 2019 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaudum/a3c02d5833d0e29e3f76d7d180a82d27 to your computer and use it in GitHub Desktop.
Save chaudum/a3c02d5833d0e29e3f76d7d180a82d27 to your computer and use it in GitHub Desktop.
import asyncio
async def do_something_long_running(sec=1) -> bool:
print(f"sleep for {sec}s")
await asyncio.sleep(sec)
return True
async def coro_a():
return await do_something_long_running()
async def coro_b():
return await not_a_coro()
def not_a_coro():
return do_something_long_running()
if __name__ == "__main__":
asyncio.run(coro_a())
asyncio.run(coro_b())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment