[Python-Dev] PEP 447 (type.__getdescriptor__)
mark at hotpy.org
Sat Jul 25 17:39:34 CEST 2015
On 22/07/15 09:25, Ronald Oussoren wrote:> Hi,
> Another summer with another EuroPython, which means its time again to
> try to revive PEP 447…
IMO, there are two main issues with the PEP and implementation.
1. The implementation as outlined in the PEP is infinitely recursive, since the
lookup of "__getdescriptor__" on type must necessarily call
The implementation (in C) special cases classes that inherit "__getdescriptor__"
from type. This special casing should be mentioned in the PEP.
2. The actual implementation in C does not account for the case where the class
of a metaclass implements __getdescriptor__ and that method returns a value when
called with "__getdescriptor__" as the argument.
Why was "__getattribute_super__" rejected as an alternative? No reason is given.
"__getattribute_super__" has none of the problems listed above.
Making super(t, obj) delegate to t.__super__(obj) seems consistent with other
builtin method/classes and doesn't add corner cases to the already complex
implementation of PyType_Lookup().
More information about the Python-Dev