Skip to content

Commit 16f209b

Browse files
sobolevnStanFromIrelandhugovkasvetlov
authored
gh-151950: Document asyncio.BaseEventLoop and fix asyncio-extending.rst (#151976)
* gh-151950: Document `async.BaseEventLoop` and fix `asyncio-extending.rst` * Apply suggestions from code review Co-authored-by: Stan Ulbrych <stan@python.org> * Update Doc/library/asyncio-extending.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --------- Co-authored-by: Stan Ulbrych <stan@python.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
1 parent b4be61e commit 16f209b

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎Doc/library/asyncio-eventloop.rst‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,6 +1967,17 @@ By default asyncio is configured to use :class:`EventLoop`.
19671967
methods that an alternative implementation of ``AbstractEventLoop``
19681968
should have defined.
19691969

1970+
.. class:: BaseEventLoop
1971+
1972+
A base class that partially implements :class:`AbstractEventLoop`
1973+
to simplify writing custom event loops.
1974+
1975+
It provides default implementations of many :class:`AbstractEventLoop`
1976+
methods, so subclasses have fewer methods to implement themselves.
1977+
In return, a subclass is expected to implement a number of internal,
1978+
protected methods.
1979+
See :ref:`writing_custom_event_loop` for more information.
1980+
19701981

19711982
Examples
19721983
========

‎Doc/library/asyncio-extending.rst‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ classes. Asyncio has helpers that could be used to simplify this task.
1212

1313
Third-parties should reuse existing asyncio code with caution,
1414
a new Python version is free to break backward compatibility
15-
in *internal* part of API.
15+
in the *internal* part of the API.
1616

1717

18-
Writing a Custom Event Loop
18+
.. _writing_custom_event_loop:
19+
20+
Writing a custom event loop
1921
===========================
2022

21-
:class:`asyncio.AbstractEventLoop` declares very many methods. Implementing all them
22-
from scratch is a tedious job.
23+
:class:`asyncio.AbstractEventLoop` declares very many methods.
24+
See :ref:`asyncio-event-loop-methods` for the full list.
25+
Implementing them all from scratch is a tedious job.
2326

2427
A loop can get many common methods implementation for free by inheriting from
2528
:class:`asyncio.BaseEventLoop`.

‎Doc/tools/.nitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Keep lines sorted lexicographically to help avoid merge conflicts.
44

55
Doc/library/ast.rst
6-
Doc/library/asyncio-extending.rst
76
Doc/library/logging.config.rst
87
Doc/library/logging.handlers.rst
98
Doc/library/multiprocessing.rst

0 commit comments

Comments
 (0)