Skip to content

Instantly share code, notes, and snippets.

@lanfon72
Created May 17, 2017 15:50
Show Gist options
  • Select an option

  • Save lanfon72/3228ee6de8436a4537e5fd56daaa3332 to your computer and use it in GitHub Desktop.

Select an option

Save lanfon72/3228ee6de8436a4537e5fd56daaa3332 to your computer and use it in GitHub Desktop.
asyncio.callback
import asyncio
loop = asyncio.get_event_loop()
def p(val, stop=False):
print(val)
if stop:
loop = asyncio.get_event_loop()
loop.stop()
h = loop.call_soon(p, 'hello')
loop.call_later(2, p, 'world', True)
print(h, loop._ready, loop._scheduled, sep='\n')
loop.run_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment