Created
November 30, 2018 07:28
-
-
Save dhensen/f7e6ad763fde345c645cf7530488c04b to your computer and use it in GitHub Desktop.
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 foo(): | |
print('hello') | |
tasks = [ | |
bar(), | |
bar(), | |
bar(), | |
bar(), | |
bar(), | |
bar(), | |
] | |
return await asyncio.gather(*tasks) | |
async def bar(): | |
await asyncio.sleep(1) | |
print('world') | |
asyncio.run(foo()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment