[Python-checkins] gh-103373: Improve documentation for `__mro_entries__` (GH-103374)
miss-islington
webhook-mailer at python.org
Sat Apr 8 10:16:50 EDT 2023
https://github.com/python/cpython/commit/77359a86b8b48991eb1b411be1b84662343c8fe3
commit: 77359a86b8b48991eb1b411be1b84662343c8fe3
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2023-04-08T07:16:43-07:00
summary:
gh-103373: Improve documentation for `__mro_entries__` (GH-103374)
(cherry picked from commit 0ba0ca05d2b56afa0b055db02233e703fe138918)
Co-authored-by: Alex Waygood <Alex.Waygood at Gmail.com>
files:
M Doc/reference/datamodel.rst
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 87c538f6f2c1..b086be26999c 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2085,11 +2085,15 @@ When a class definition is executed, the following steps occur:
Resolving MRO entries
^^^^^^^^^^^^^^^^^^^^^
-If a base that appears in class definition is not an instance of :class:`type`,
-then an ``__mro_entries__`` method is searched on it. If found, it is called
-with the original bases tuple. This method must return a tuple of classes that
-will be used instead of this base. The tuple may be empty, in such case
-the original base is ignored.
+.. method:: object.__mro_entries__(self, bases)
+
+ 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.
+ If an ``__mro_entries__`` method is found, the base is substituted with the
+ result of a call to ``__mro_entries__`` when creating the class.
+ The method is called with the original bases tuple, and must return a tuple
+ of classes that will be used instead of the base. The returned tuple may be
+ empty: in these cases, the original base is ignored.
.. seealso::
More information about the Python-checkins
mailing list