(Merge 3.4) asyncio doc: reformat event loop policy doc

This commit is contained in:
Victor Stinner 2014-11-28 13:58:53 +01:00
commit 74210e1e0f
1 changed files with 18 additions and 8 deletions

View File

@ -150,6 +150,7 @@ loop per thread that interacts with :mod:`asyncio`. The module-level functions
:func:`get_event_loop` and :func:`set_event_loop` provide convenient access to :func:`get_event_loop` and :func:`set_event_loop` provide convenient access to
event loops managed by the default policy. event loops managed by the default policy.
Event loop policy interface Event loop policy interface
--------------------------- ---------------------------
@ -157,12 +158,18 @@ An event loop policy must implement the following interface:
.. class:: AbstractEventLoopPolicy .. class:: AbstractEventLoopPolicy
Event loop policy.
.. method:: get_event_loop() .. method:: get_event_loop()
Get the event loop for the current context. Returns an event loop object Get the event loop for the current context.
implementing the :class:`BaseEventLoop` interface, or raises an exception in case
no event loop has been set for the current context and the current policy Returns an event loop object implementing the :class:`BaseEventLoop`
does not specify to create one. It should never return ``None``. interface.
Raises an exception in case no event loop has been set for the current
context and the current policy does not specify to create one. It must
never return ``None``.
.. method:: set_event_loop(loop) .. method:: set_event_loop(loop)
@ -170,9 +177,12 @@ An event loop policy must implement the following interface:
.. method:: new_event_loop() .. method:: new_event_loop()
Create and return a new event loop object according to this policy's rules. Create and return a new event loop object according to this policy's
If there's need to set this loop as the event loop for the current context, rules.
:meth:`set_event_loop` must be called explicitly.
If there's need to set this loop as the event loop for the current
context, :meth:`set_event_loop` must be called explicitly.
Access to the global loop policy Access to the global loop policy
-------------------------------- --------------------------------