summaryrefslogtreecommitdiffstats
path: root/Doc/reference
diff options
context:
space:
mode:
authorTal Einat <taleinat+github@gmail.com>2019-11-28 05:22:09 (GMT)
committerGitHub <noreply@github.com>2019-11-28 05:22:09 (GMT)
commit02519f75d15b063914a11351da30178ca4ceb54b (patch)
treea8d45a71d7b5cb367c368d3de2a491714547a96a /Doc/reference
parentd9aa216d49423d58e192cd7a25016f90fe771ce7 (diff)
downloadcpython-02519f75d15b063914a11351da30178ca4ceb54b.zip
cpython-02519f75d15b063914a11351da30178ca4ceb54b.tar.gz
cpython-02519f75d15b063914a11351da30178ca4ceb54b.tar.bz2
bpo-38524: clarify example a bit and improve formatting (GH-17406)
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/datamodel.rst13
1 files changed, 8 insertions, 5 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 6809850..b22ed92 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -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.