loop = asyncio.get_event_loop()
loop.run_until_complete(print_sum(1, 2))
+ loop.close()
``compute()`` is chained to ``print_sum()``: ``print_sum()`` coroutine waits
until ``compute()`` is completed before returing its result.
asyncio.Task(slow_operation(future))
loop.run_until_complete(future)
print(future.result())
+ loop.close()
The coroutine function is responsible of the computation (which takes 1 second)
and it stores the result into the future. The
loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait(tasks))
+ loop.close()
Output::