mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
bpo-33649: Add high-level APIs cheat-sheet (GH-9319)
This commit is contained in:
parent
6c7316439d
commit
7372c3bbef
9 changed files with 229 additions and 6 deletions
|
|
@ -165,7 +165,7 @@ Sleeping
|
|||
If *result* is provided, it is returned to the caller
|
||||
when the coroutine completes.
|
||||
|
||||
.. _asyncio-date-coroutine:
|
||||
.. _asyncio_example_sleep:
|
||||
|
||||
Example of coroutine displaying the current date every second
|
||||
during 5 seconds::
|
||||
|
|
@ -219,6 +219,8 @@ Running Tasks Concurrently
|
|||
If the *gather* itself is cancelled, the cancellation is
|
||||
propagated regardless of *return_exceptions*.
|
||||
|
||||
.. _asyncio_example_gather:
|
||||
|
||||
Example::
|
||||
|
||||
import asyncio
|
||||
|
|
@ -316,6 +318,8 @@ Timeouts
|
|||
|
||||
If the wait is cancelled, the future *fut* is also cancelled.
|
||||
|
||||
.. _asyncio_example_waitfor:
|
||||
|
||||
Example::
|
||||
|
||||
async def eternity():
|
||||
|
|
@ -539,6 +543,8 @@ Task Object
|
|||
suppressing cancellation completely is not common and is actively
|
||||
discouraged.
|
||||
|
||||
.. _asyncio_example_task_cancel:
|
||||
|
||||
The following example illustrates how coroutines can intercept
|
||||
the cancellation request::
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue