mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
Issue #24400: Mention that __instancecheck__ is used in abc.Awaitable and Coroutine
This commit is contained in:
parent
f27015255f
commit
cc1d0287b5
2 changed files with 13 additions and 1 deletions
|
@ -44,7 +44,7 @@ exclude_patterns = ['venv/*']
|
||||||
# -----------------------
|
# -----------------------
|
||||||
|
|
||||||
# Use our custom theme.
|
# Use our custom theme.
|
||||||
html_theme = 'pydoctheme'
|
html_theme = 'classic'
|
||||||
html_theme_path = ['tools']
|
html_theme_path = ['tools']
|
||||||
html_theme_options = {'collapsiblesidebar': True}
|
html_theme_options = {'collapsiblesidebar': True}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,12 @@ ABC Inherits from Abstract Methods Mixin
|
||||||
:term:`Coroutine` objects and instances of the
|
:term:`Coroutine` objects and instances of the
|
||||||
:class:`~collections.abc.Coroutine` ABC are all instances of this ABC.
|
:class:`~collections.abc.Coroutine` ABC are all instances of this ABC.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
In CPython, generator-based coroutines are *awaitables*, even though
|
||||||
|
they do not have an :meth:`__await__` method. This ABC
|
||||||
|
implements an :meth:`~class.__instancecheck__` method to make them
|
||||||
|
instances of itself.
|
||||||
|
|
||||||
.. versionadded:: 3.5
|
.. versionadded:: 3.5
|
||||||
|
|
||||||
.. class:: Coroutine
|
.. class:: Coroutine
|
||||||
|
@ -172,6 +178,12 @@ ABC Inherits from Abstract Methods Mixin
|
||||||
:meth:`__await__`. All :class:`Coroutine` instances are also instances of
|
:meth:`__await__`. All :class:`Coroutine` instances are also instances of
|
||||||
:class:`Awaitable`. See also the definition of :term:`coroutine`.
|
:class:`Awaitable`. See also the definition of :term:`coroutine`.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
In CPython, generator-based coroutines are *awaitables* and *coroutines*,
|
||||||
|
even though they do not have an :meth:`__await__` method. This ABC
|
||||||
|
implements an :meth:`~class.__instancecheck__` method to make them
|
||||||
|
instances of itself.
|
||||||
|
|
||||||
.. versionadded:: 3.5
|
.. versionadded:: 3.5
|
||||||
|
|
||||||
.. class:: AsyncIterable
|
.. class:: AsyncIterable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue