mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Update asyncio documentation
- Document the new create_task() method - "Hide" the Task class: point to the create_task() method for interoperability - Rewrite the documentation of the Task class - Document the "Pending task destroyed" - Update output in debug mode of examples in the dev section - Replace Task() with create_task() in examples
This commit is contained in:
parent
896a25ab30
commit
530ef2f069
4 changed files with 131 additions and 49 deletions
|
@ -102,8 +102,8 @@ Run an event loop
|
|||
|
||||
Run until the :class:`Future` is done.
|
||||
|
||||
If the argument is a :ref:`coroutine <coroutine>`, it is wrapped
|
||||
in a :class:`Task`.
|
||||
If the argument is a :ref:`coroutine object <coroutine>`, it is wrapped by
|
||||
:func:`async`.
|
||||
|
||||
Return the Future's result, or raise its exception.
|
||||
|
||||
|
@ -205,6 +205,25 @@ a different clock than :func:`time.time`.
|
|||
The :func:`asyncio.sleep` function.
|
||||
|
||||
|
||||
Coroutines
|
||||
----------
|
||||
|
||||
.. method:: BaseEventLoop.create_task(coro)
|
||||
|
||||
Schedule the execution of a :ref:`coroutine object <coroutine>`: wrap it in
|
||||
a future. Return a :class:`Task` object.
|
||||
|
||||
Third-party event loops can use their own subclass of :class:`Task` for
|
||||
interoperability. In this case, the result type is a subclass of
|
||||
:class:`Task`.
|
||||
|
||||
.. seealso::
|
||||
|
||||
The :meth:`async` function.
|
||||
|
||||
.. versionadded:: 3.4.2
|
||||
|
||||
|
||||
Creating connections
|
||||
--------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue