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

Jeroen Demeyer J.Demeyer at UGent.be
Tue May 15 16:44:36 EDT 2018


On 2018-05-15 18:36, Petr Viktorin wrote:
> What is your ultimate use case?

(I'll just answer this one question now and reply to the more technical 
comments in another thread)

My ultimate use case is being able to implement functions and methods 
which are

(A) equally fast as the existing built-in function and methods

(B) and behave from a user's point of view like Python functions.

With objective (A) I want no compromises. CPython has many optimizations 
for built-in functions and all of them should work for my new functions.

Objective (B) means more precisely:

1. Implementing __get__ to turn a function in a method.

2. Being recognized as "functions" by tools like Sphinx and IPython.

3. Introspection support such as inspect.signature() and 
inspect.getsource().


Jeroen.


More information about the Python-Dev mailing list