Created
June 18, 2019 11:20
-
-
Save chaudum/a3c02d5833d0e29e3f76d7d180a82d27 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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