]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38524: clarify example a bit and improve formatting (GH-17406)
authorTal Einat <taleinat+github@gmail.com>
Thu, 28 Nov 2019 05:22:09 +0000 (07:22 +0200)
committerGitHub <noreply@github.com>
Thu, 28 Nov 2019 05:22:09 +0000 (07:22 +0200)
Doc/reference/datamodel.rst

index 68098508afbaa28cfed55bc57e9b2241892e12a3..b22ed92ec964d2478ae5d907814e442e9b96bb1e 100644 (file)
@@ -1657,13 +1657,16 @@ class' :attr:`~object.__dict__`.
 
    .. note::
 
-      ``__set_name__`` is only called implicitly as part of the ``type`` constructor, so
-      it will need to be called explicitly with the appropriate parameters when a
-      descriptor is added to a class after initial creation::
+      :meth:`__set_name__` is only called implicitly as part of the
+      :class:`type` constructor, so it will need to be called explicitly with
+      the appropriate parameters when a descriptor is added to a class after
+      initial creation::
 
+         class A:
+            pass
          descr = custom_descriptor()
-         cls.attr = descr
-         descr.__set_name__(cls, 'attr')
+         A.attr = descr
+         descr.__set_name__(A, 'attr')
 
       See :ref:`class-object-creation` for more details.