Skip to content

Commit c0db88f

Browse files
bpo-38524: clarify example a bit and improve formatting (GH-17406)
(cherry picked from commit 02519f7) Co-authored-by: Tal Einat <[email protected]>
1 parent d21b8e8 commit c0db88f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Doc/reference/datamodel.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,13 +1657,16 @@ class' :attr:`~object.__dict__`.
16571657

16581658
.. note::
16591659

1660-
``__set_name__`` is only called implicitly as part of the ``type`` constructor, so
1661-
it will need to be called explicitly with the appropriate parameters when a
1662-
descriptor is added to a class after initial creation::
1660+
:meth:`__set_name__` is only called implicitly as part of the
1661+
:class:`type` constructor, so it will need to be called explicitly with
1662+
the appropriate parameters when a descriptor is added to a class after
1663+
initial creation::
16631664

1665+
class A:
1666+
pass
16641667
descr = custom_descriptor()
1665-
cls.attr = descr
1666-
descr.__set_name__(cls, 'attr')
1668+
A.attr = descr
1669+
descr.__set_name__(A, 'attr')
16671670

16681671
See :ref:`class-object-creation` for more details.
16691672

0 commit comments

Comments
 (0)