mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Close #22473: asyncio doc: rephrase Future with run_forever() example
This commit is contained in:
parent
eb2763dd43
commit
039f703b7b
1 changed files with 3 additions and 8 deletions
|
@ -337,14 +337,9 @@ flow::
|
|||
finally:
|
||||
loop.close()
|
||||
|
||||
In this example, the future is responsible to display the result and to stop
|
||||
the loop.
|
||||
|
||||
.. note::
|
||||
The "slow_operation" coroutine object is only executed when the event loop
|
||||
starts running, so it is possible to add a "done callback" to the future
|
||||
after creating the task scheduling the coroutine object.
|
||||
|
||||
In this example, the future is used to link ``slow_operation()`` to
|
||||
``got_result()``: when ``slow_operation()`` is done, ``got_result()`` is called
|
||||
with the result.
|
||||
|
||||
|
||||
Task
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue