Skip to content

Commit 7e9bbbe

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 e65b3fa commit 7e9bbbe

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
@@ -1643,13 +1643,16 @@ class' :attr:`~object.__dict__`.
16431643

16441644
.. note::
16451645

1646-
``__set_name__`` is only called implicitly as part of the ``type`` constructor, so
1647-
it will need to be called explicitly with the appropriate parameters when a
1648-
descriptor is added to a class after initial creation::
1646+
:meth:`__set_name__` is only called implicitly as part of the
1647+
:class:`type` constructor, so it will need to be called explicitly with
1648+
the appropriate parameters when a descriptor is added to a class after
1649+
initial creation::
16491650

1651+
class A:
1652+
pass
16501653
descr = custom_descriptor()
1651-
cls.attr = descr
1652-
descr.__set_name__(cls, 'attr')
1654+
A.attr = descr
1655+
descr.__set_name__(A, 'attr')
16531656

16541657
See :ref:`class-object-creation` for more details.
16551658

0 commit comments

Comments
 (0)