Skip to content

Instantly share code, notes, and snippets.

@AstraLuma
Last active April 16, 2018 19:32
Show Gist options
  • Select an option

  • Save AstraLuma/d9c7222ac78345fd6f641a2b09a61343 to your computer and use it in GitHub Desktop.

Select an option

Save AstraLuma/d9c7222ac78345fd6f641a2b09a61343 to your computer and use it in GitHub Desktop.
Async Talk Code Examples
import asyncio
async def say(what, when):
await asyncio.sleep(when)
print(what)
# print() is already buffered by Python, IPC Pipes, etc
# You should still async it, but it's only going to bite
# when other things go wrong.
loop = asyncio.get_event_loop()
loop.run_until_complete(say('Hello, World!', 1))
loop.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment