summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-11-27 21:28:37 -0800
committerGitHub <noreply@github.com>2019-11-27 21:28:37 -0800
commit7e9bbbe51e74e5928e6a6c3e70434d824970ef58 (patch)
tree04faddb1eb25bf9d7536b6e6d71a6498a9638647
parente65b3fa9f16537d20f5f37c25673ac899fcd7099 (diff)
downloadcpython-git-7e9bbbe51e74e5928e6a6c3e70434d824970ef58.tar.gz
bpo-38524: clarify example a bit and improve formatting (GH-17406)
(cherry picked from commit 02519f75d15b063914a11351da30178ca4ceb54b) Co-authored-by: Tal Einat <taleinat+github@gmail.com>
-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 7a99e1e522..b4f9ddc119 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -1643,13 +1643,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.