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 @@ -1643,13 +1643,16 @@ class' :attr:`~object.__dict__`.
1643
1643
1644
1644
.. note ::
1645
1645
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::
1649
1650
1651
+ class A:
1652
+ pass
1650
1653
descr = custom_descriptor()
1651
- cls .attr = descr
1652
- descr.__set_name__(cls , 'attr')
1654
+ A .attr = descr
1655
+ descr.__set_name__(A , 'attr')
1653
1656
1654
1657
See :ref: `class-object-creation ` for more details.
1655
1658
You can’t perform that action at this time.
0 commit comments