bpo-33649: Add high-level APIs cheat-sheet (GH-9319)

This commit is contained in:
Yury Selivanov 2018-09-14 15:11:24 -07:00 committed by GitHub
parent 6c7316439d
commit 7372c3bbef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 229 additions and 6 deletions

View file

@ -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::