Created
May 10, 2019 07:18
-
-
Save odoku/d6f5b11597f2e8cb16df9c3bd1072c04 to your computer and use it in GitHub Desktop.
python - coroutine
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 wait(): | |
print('Waiting') | |
for x in range(10 ** 100): | |
z = 10 + 20 | |
print('Done') | |
def main(): | |
coroutines = [wait() for x in range(0, 10)] | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(asyncio.wait(coroutines)) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment