diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-08 10:39:10 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-08 10:39:10 (GMT) |
commit | 530ef2f0693d50435a8d62ea84d3fdcbe662d8aa (patch) | |
tree | 2aa2c368fab19c3353e9c1e282d46c1596ee4af4 /Doc/library/asyncio-eventloop.rst | |
parent | 896a25ab30269369201401b50c66130911dd2238 (diff) | |
download | cpython-530ef2f0693d50435a8d62ea84d3fdcbe662d8aa.zip cpython-530ef2f0693d50435a8d62ea84d3fdcbe662d8aa.tar.gz cpython-530ef2f0693d50435a8d62ea84d3fdcbe662d8aa.tar.bz2 |
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
Diffstat (limited to 'Doc/library/asyncio-eventloop.rst')
-rw-r--r-- | Doc/library/asyncio-eventloop.rst | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 268fa41..1a80921 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -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 -------------------- |