Skip to content

Commit 933f8f3

Browse files
committed
explain __base__ attribute in the datamodel doc
1 parent 7997fc9 commit 933f8f3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Doc/reference/datamodel.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,13 @@ Custom classes
853853
A tuple containing the base classes, in the order of
854854
their occurrence in the base class list.
855855

856+
:attr:`~class.__base__`
857+
``__base__`` corresponds to the :c:member:`~PyTypeObject.tp_base` in a
858+
type object. At the C level, Python has a single inheritance model
859+
that determines the memory layout of instances. There is a chain
860+
involving base classes that contribute to the instance layout.
861+
``__base__`` is the base class that is involved in that chain.
862+
856863
:attr:`__doc__`
857864
The class's documentation string, or ``None`` if undefined.
858865

0 commit comments

Comments
 (0)