osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] PEP 575 (Unifying function/method classes) update


Hello all,

I have updated PEP 575 and its reference implementation. See
https://www.python.org/dev/peps/pep-0575/
The main differences with respect to the previous version are:

* METH_PASS_FUNCTION now passes the function *in addition* to self 
(previously, it was passed *instead* of self).

* __objclass__ was generalized to __parent__ and stores either the 
defining class or the defining module of a built-in function/method.

* Proposed two-phase implementation for better backwards compatibility 
(at the cost of added complexity).

The first two items on the above list are meant to prepare for PEP 573 
but are sufficiently useful by itself to add them to PEP 575.

On this mailing list, there have been concerns about backwards 
compatibility. This PEP does indeed affect code not using duck typing, 
but using type checks or things like inspect.isbuiltin(). Note that 
"affect" != "break". I don't know how bad this presumed breakage is. 
Personally, I think it will be acceptable, but others may disagree. What 
I *do* know for sure is that very little breaks in the Python standard 
library. If anybody has a clever idea to estimate the breakage, I would 
love to know.


Jeroen.