Skip to content

Instantly share code, notes, and snippets.

@odoku
Created May 10, 2019 07:18
Show Gist options
  • Save odoku/d6f5b11597f2e8cb16df9c3bd1072c04 to your computer and use it in GitHub Desktop.
Save odoku/d6f5b11597f2e8cb16df9c3bd1072c04 to your computer and use it in GitHub Desktop.
python - coroutine
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