File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -1657,13 +1657,16 @@ class' :attr:`~object.__dict__`.
1657
1657
1658
1658
.. note ::
1659
1659
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::
1663
1664
1665
+ class A:
1666
+ pass
1664
1667
descr = custom_descriptor()
1665
- cls .attr = descr
1666
- descr.__set_name__(cls , 'attr')
1668
+ A .attr = descr
1669
+ descr.__set_name__(A , 'attr')
1667
1670
1668
1671
See :ref: `class-object-creation ` for more details.
1669
1672
You can’t perform that action at this time.
0 commit comments