Instead of init_event_loop(), define new_event_loop().

This commit is contained in:
Guido van Rossum 2013-01-08 15:45:25 -08:00
parent 9dd10fc3c8
commit b9c08eaf8f
1 changed files with 4 additions and 4 deletions

View File

@ -126,16 +126,16 @@ equivalent. This uses the same notion of context as
``get_event_loop()``. ``get_event_loop()``.
For the benefit of unit tests and other special cases there's a third For the benefit of unit tests and other special cases there's a third
policy function: ``init_event_loop()``, which creates a new EventLoop policy function: ``new_event_loop()``, which creates and returns a new
instance and calls ``set_event_loop()`` with it. TBD: Maybe we should EventLoop instance according to the policy's default rules. To make
have a ``create_default_event_loop_instance()`` function instead? this the current event loop, you must call ``set_event_loop()``.
To change the way the above three functions work To change the way the above three functions work
(including their notion of context), call (including their notion of context), call
``set_event_loop_policy(policy)``, where ``policy`` is an event loop ``set_event_loop_policy(policy)``, where ``policy`` is an event loop
policy object. The policy object can be any object that has methods policy object. The policy object can be any object that has methods
``get_event_loop()``, ``set_event_loop(event_loop)`` ``get_event_loop()``, ``set_event_loop(event_loop)``
and ``init_event_loop()`` behaving like and ``new_event_loop()`` behaving like
the functions described above. The default event loop policy is an the functions described above. The default event loop policy is an
instance of the class ``DefaultEventLoopPolicy``. The current event loop instance of the class ``DefaultEventLoopPolicy``. The current event loop
policy object can be retrieved by calling ``get_event_loop_policy()``. policy object can be retrieved by calling ``get_event_loop_policy()``.