Skip to content

Instantly share code, notes, and snippets.

@alexandre
Created October 17, 2014 18:47
Show Gist options
  • Select an option

  • Save alexandre/96dddef82d9d0001d9f1 to your computer and use it in GitHub Desktop.

Select an option

Save alexandre/96dddef82d9d0001d9f1 to your computer and use it in GitHub Desktop.
import asyncio
def get_result(result, loop):
print("Que bom que a função me mandou um '{}'".format(result))
loop.call_later(2, print_and_repeat, loop)
def print_and_repeat(loop):
result = 'Como vai?'
print('Ok, vou mandar um {} para a aminha amiga função'.format(result))
loop.call_later(2, get_result, result, loop)
loop = asyncio.get_event_loop()
loop.call_soon(print_and_repeat, loop)
loop.run_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment