Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
df3297b
Explain __base__ attribute in the docs
furkanonder Mar 9, 2023
7997fc9
explain __base__ attribute in the stdtypes doc
furkanonder Mar 9, 2023
933f8f3
explain __base__ attribute in the datamodel doc
furkanonder Mar 9, 2023
53be240
Add note to the __base__ attribute explanation
furkanonder Mar 9, 2023
548abb8
fix doc tests
furkanonder Mar 9, 2023
90c3b74
Use right markup for CPython implementation
furkanonder Mar 13, 2023
6d1ad66
Use impl-detail:: markup instead of note::
furkanonder Mar 13, 2023
b676958
harmonize indentation
merwok May 11, 2023
68e557b
fix wording for CPython
furkanonder Jan 20, 2024
6b13541
resolve conflict
furkanonder Jan 20, 2024
01c2912
remove __base__ explaination in the object.rst and stdtypes.rst
furkanonder Jan 21, 2024
53bd224
remove __base__ explaination in the datamodel.rst
furkanonder Jan 21, 2024
dabe938
add __base__ explaination into Doc/c-api/object.rst
furkanonder Jan 21, 2024
1275b18
Merge branch 'python:main' into issue-66646
furkanonder Jan 21, 2024
f0fb022
Use :attr:`~class.__base__` instead of :attr:`__base__`
furkanonder Jan 22, 2024
0246fe2
Merge branch 'main' into issue-66646
furkanonder Aug 19, 2025
15b8649
Fix __base__ attribute references and description
furkanonder Aug 20, 2025
9e10d94
Simplify __base__ attribute explanation
furkanonder Aug 25, 2025
ed7169c
Document __base__ attribute in data model reference
furkanonder Sep 19, 2025
96381b4
Merge branch 'main' into issue-66646
furkanonder Sep 19, 2025
20a5da7
Document __base__ attribute with single impl-detail block
furkanonder Oct 15, 2025
71638d2
Merge branch 'main' into issue-66646
furkanonder Oct 15, 2025
ec6d7d3
Add blank line after documentation of __base__ attribute
furkanonder Oct 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/object.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Object Protocol
class, are considered classes. However, objects can override this by having
a :attr:`~class.__bases__` attribute (which must be a tuple of base classes).

Another function, :attr:`__base__` that is specific to Cpython and also
Another function, :attr:`__base__` that is specific to CPython and also
exists in Jython and PyPy can also be used on a class inheriting from one
or more classes. When such a class takes arguments in the correct order,
then starting leftmost.
Expand Down
39 changes: 27 additions & 12 deletions Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -982,18 +982,33 @@ Special attributes:
:attr:`~object.__dict__`
The dictionary containing the class's namespace.

:attr:`~class.__base__`
``__base__`` corresponds to the :c:member:`~PyTypeObject.tp_base` in a
type object. At the C level, Python has a single inheritance model
that determines the memory layout of instances. There is a chain
involving base classes that contribute to the instance layout.
``__base__`` is the base class that is involved in that chain.

.. impl-detail::
The behavior of the ``__base__`` attribute is dependent on the :term:`CPython` implementation.

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

.. impl-detail::
The behavior of the ``__base__`` attribute is dependent on the :term:`CPython` implementation.

:attr:`~class.__bases__`
A tuple containing the base classes, in the order of
their occurrence in the base class list.

:attr:`__doc__`
The class's documentation string, or ``None`` if undefined.

:attr:`__annotations__`
A dictionary containing
:term:`variable annotations <variable annotation>`
collected during class body execution. For best practices on
working with :attr:`__annotations__`, please see
:ref:`annotations-howto`.

:attr:`__type_params__`
A tuple containing the :ref:`type parameters <type-params>` of
a :ref:`generic class <generic-classes>`.


Class instances
Expand Down