mirror of
https://github.com/python/cpython.git
synced 2025-11-27 13:45:25 +00:00
gh-103373: __mro_entries__ docs: improve cross references (#103398)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
This commit is contained in:
parent
21bea68e2e
commit
e071f00aae
2 changed files with 12 additions and 7 deletions
|
|
@ -75,9 +75,9 @@ Dynamic Type Creation
|
||||||
|
|
||||||
This function looks for items in *bases* that are not instances of
|
This function looks for items in *bases* that are not instances of
|
||||||
:class:`type`, and returns a tuple where each such object that has
|
:class:`type`, and returns a tuple where each such object that has
|
||||||
an ``__mro_entries__`` method is replaced with an unpacked result of
|
an :meth:`~object.__mro_entries__` method is replaced with an unpacked result of
|
||||||
calling this method. If a *bases* item is an instance of :class:`type`,
|
calling this method. If a *bases* item is an instance of :class:`type`,
|
||||||
or it doesn't have an ``__mro_entries__`` method, then it is included in
|
or it doesn't have an :meth:`!__mro_entries__` method, then it is included in
|
||||||
the return tuple unchanged.
|
the return tuple unchanged.
|
||||||
|
|
||||||
.. versionadded:: 3.7
|
.. versionadded:: 3.7
|
||||||
|
|
|
||||||
|
|
@ -2089,16 +2089,21 @@ Resolving MRO entries
|
||||||
.. method:: object.__mro_entries__(self, bases)
|
.. method:: object.__mro_entries__(self, bases)
|
||||||
|
|
||||||
If a base that appears in a class definition is not an instance of
|
If a base that appears in a class definition is not an instance of
|
||||||
:class:`type`, then an ``__mro_entries__`` method is searched on the base.
|
:class:`type`, then an :meth:`!__mro_entries__` method is searched on the base.
|
||||||
If an ``__mro_entries__`` method is found, the base is substituted with the
|
If an :meth:`!__mro_entries__` method is found, the base is substituted with the
|
||||||
result of a call to ``__mro_entries__`` when creating the class.
|
result of a call to :meth:`!__mro_entries__` when creating the class.
|
||||||
The method is called with the original bases tuple, and must return a tuple
|
The method is called with the original bases tuple
|
||||||
|
passed to the *bases* parameter, and must return a tuple
|
||||||
of classes that will be used instead of the base. The returned tuple may be
|
of classes that will be used instead of the base. The returned tuple may be
|
||||||
empty: in these cases, the original base is ignored.
|
empty: in these cases, the original base is ignored.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
:pep:`560` - Core support for typing module and generic types
|
:func:`types.resolve_bases`
|
||||||
|
Dynamically resolve bases that are not instances of :class:`type`.
|
||||||
|
|
||||||
|
:pep:`560`
|
||||||
|
Core support for typing module and generic types.
|
||||||
|
|
||||||
|
|
||||||
Determining the appropriate metaclass
|
Determining the appropriate metaclass
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue