Created
February 27, 2018 12:15
-
-
Save singulared/c62b43ac4cf76ed042d31aa7c71aa682 to your computer and use it in GitHub Desktop.
ensure_future scheduled corotine
This file contains 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 d(): | |
print('d start') | |
await asyncio.sleep(2) | |
print('d stop') | |
async def f(): | |
print('f start') | |
asyncio.ensure_future(d()) | |
await asyncio.sleep(3) | |
print('f stop') | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(f()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment