Message407965
So the current (after the aforementioned commit) form of the description is:
A dotted lookup such as ``super(A, a).x`` searches
``obj.__class__.__mro__`` for a base class ``B`` following ``A`` and then
returns ``B.__dict__['x'].__get__(a, A)``. If not a descriptor, ``x`` is
returned unchanged.
I guess here ``obj`` was supposed to be ``a``.
But is the description correct when it comes to what class is used where?
I.e., shouldn't it be rather something along the lines of the following:
A dotted lookup such as ``super(A, obj).x`` (where ``obj`` is an
instance of ``A`` of some other subclass of ``A``) searches
``A.__mro__`` for a base class ``B`` whose `__dict__` contains name
``"x"`` and then returns ``B.__dict__['x'].__get__(obj, type(obj))``.
If ``B.__dict__['x']`` is not a descriptor, it is returned unchanged.
***
Ad my comment #2 -- yes, it became groundless with time... Minor explanation: when I reported this issue in 2015, the signature of `object.__get__` was documented just as "__get__(self, instance, owner)" (see: https://docs.python.org/3.5/reference/datamodel.html#implementing-descriptors); that's why I wrote about an inconsistency. |
|
Date |
User |
Action |
Args |
2021-12-07 20:55:49 | zuo | set | recipients:
+ zuo, rhettinger, docs@python, martin.panter |
2021-12-07 20:55:49 | zuo | set | messageid: <1638910549.1.0.676419673361.issue20751@roundup.psfhosted.org> |
2021-12-07 20:55:49 | zuo | link | issue20751 messages |
2021-12-07 20:55:48 | zuo | create | |
|