mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #10771: Clarify that descriptors get used in an *owner* class or one of its parents.
This commit is contained in:
parent
405a4717e1
commit
1fd26525a4
1 changed files with 5 additions and 5 deletions
|
@ -1539,11 +1539,11 @@ Implementing Descriptors
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
The following methods only apply when an instance of the class containing the
|
The following methods only apply when an instance of the class containing the
|
||||||
method (a so-called *descriptor* class) appears in the class dictionary of
|
method (a so-called *descriptor* class) appears in an *owner* class (the
|
||||||
another new-style class (known as the *owner* class) or one of its
|
descriptor must be in either the owner's class dictionary or in the class
|
||||||
descendants. In the examples below, "the attribute" refers to the attribute
|
dictionary for one of its parents). In the examples below, "the attribute"
|
||||||
whose name is the key of the property in the owner class' ``__dict__``.
|
refers to the attribute whose name is the key of the property in the owner
|
||||||
Descriptors can only be implemented as new-style classes themselves.
|
class' :attr:`__dict__`.
|
||||||
|
|
||||||
|
|
||||||
.. method:: object.__get__(self, instance, owner)
|
.. method:: object.__get__(self, instance, owner)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue