[Python-Dev] PEP 575: Unifying function/method classes

Raymond Hettinger raymond.hettinger at gmail.com
Fri Apr 13 15:30:13 EDT 2018


> On Apr 12, 2018, at 9:12 AM, Jeroen Demeyer <J.Demeyer at UGent.be> wrote:
> 
> I would like to request a review of PEP 575, which is about changing the classes used for built-in functions and Python functions and methods. The text of the PEP can be found at
> 
> https://www.python.org/dev/peps/pep-0575/

Thanks for doing this work.  The PEP is well written and I'm +1 on the general idea of what it's trying to do (I'm still taking in all the details).

It would be nice to have a section that specifically discusses the implications with respect to other existing function-like tooling:  classmethod, staticmethod, partial, itemgetter, attrgetter, methodgetter, etc.

Also, please mention the backward compatibility issue that will arise for code that currently relies on types.MethodType, types.BuiltinFunctionType, types.BuiltinMethodType, etc.  For example, I would need to update the code in random._randbelow().  That code uses the existing builtin-vs-pure-python type distinctions to determine whether either the random() or getrandbits() methods have been overridden.   This is likely an easy change for me to make, but there may be code like it the wild, code that would be broken if the distinction is lost.


Raymond









More information about the Python-Dev mailing list