Skip to content

Instantly share code, notes, and snippets.

@aaossa
Last active July 10, 2016 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaossa/b0e77fd60b544070bff457765a07cea7 to your computer and use it in GitHub Desktop.
Save aaossa/b0e77fd60b544070bff457765a07cea7 to your computer and use it in GitHub Desktop.
Simple Python 3.5 asyncio base
import asyncio
async def slow_operation(n):
await asyncio.sleep(n)
print("{} Slow operation complete".format(n))
async def main():
await asyncio.wait([slow_operation(1),
slow_operation(2),
slow_operation(3)])
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment