mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
asyncio doc: cleanup Hello World examples
This commit is contained in:
parent
5121a9ba4a
commit
6888b96cee
2 changed files with 11 additions and 6 deletions
|
@ -633,13 +633,16 @@ Handle
|
||||||
Cancel the call.
|
Cancel the call.
|
||||||
|
|
||||||
|
|
||||||
|
Event loop examples
|
||||||
|
===================
|
||||||
|
|
||||||
.. _asyncio-hello-world-callback:
|
.. _asyncio-hello-world-callback:
|
||||||
|
|
||||||
Example: Hello World (callback)
|
Hello World with a callback
|
||||||
-------------------------------
|
---------------------------
|
||||||
|
|
||||||
Print ``Hello World`` every two seconds, using a callback::
|
Print ``"Hello World"`` every two seconds using a callback scheduled by the
|
||||||
|
:meth:`BaseEventLoop.call_soon` method::
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
@ -656,7 +659,8 @@ Print ``Hello World`` every two seconds, using a callback::
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
:ref:`Hello World example using a coroutine <asyncio-hello-world-coroutine>`.
|
The :ref:`Hello World coroutine <asyncio-hello-world-coroutine>` example
|
||||||
|
uses a :ref:`coroutine <coroutine>`.
|
||||||
|
|
||||||
|
|
||||||
Example: Set signal handlers for SIGINT and SIGTERM
|
Example: Set signal handlers for SIGINT and SIGTERM
|
||||||
|
|
|
@ -98,8 +98,9 @@ Print ``"Hello World"`` every two seconds using a coroutine::
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
:ref:`Hello World example using a callback <asyncio-hello-world-callback>`.
|
The :ref:`Hello World with a callback <asyncio-hello-world-callback>`
|
||||||
|
example uses a callback scheduled by the :meth:`BaseEventLoop.call_soon`
|
||||||
|
method.
|
||||||
|
|
||||||
Example: Chain coroutines
|
Example: Chain coroutines
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue