Message212035
1. One misleading detail in the descriptor protocol documentation for super bindings is that the following fragment of the http://docs.python.org/reference/datamodel.html#invoking-descriptors page:
"""
Super Binding
If a is an instance of super, then the binding super(B, obj).m() searches obj.__class__.__mro__ for the base class A immediately preceding B and then invokes the descriptor with the call: A.__dict__['m'].__get__(obj, obj.__class__).
"""
...introduces the method *call* (".m()") which AFAIK has nothing to do with the actual matter of the description (attribute resolution).
Also, the "If *a* is an instance of super" fragment is strange, as *a* is not used in the following sentences at all.
I believe the description should be:
"""
Super Binding
If binding to a super instance, super(B, obj).x searches obj.__class__.__mro__ for the base class A immediately preceding B and then invokes the descriptor with the call: A.__dict__['x'].__get__(obj, obj.__class__).
"""
(using 'x' as the attribute name, as for the other kinds of binding).
***
2. Also, in some earlier fragment of the same page:
"""
Direct Call
The simplest and least common call is when user code directly invokes a descriptor method: x.__get__(a).
"""
The call x.__get__(a) without the second argument seems to be wrong if __get__ is implemented according to the specification "object.__get__(self, instance, owner)" from the same documentation page. |
|
Date |
User |
Action |
Args |
2014-02-23 22:13:56 | zuo | set | recipients:
+ zuo, docs@python |
2014-02-23 22:13:56 | zuo | set | messageid: <1393193636.36.0.125202538555.issue20751@psf.upfronthosting.co.za> |
2014-02-23 22:13:56 | zuo | link | issue20751 messages |
2014-02-23 22:13:55 | zuo | create | |
|