[Python-ideas] Add the method decorator

Jeroen Demeyer J.Demeyer at UGent.be
Thu Apr 12 10:32:37 EDT 2018


On 2018-04-12 15:57, Serhiy Storchaka wrote:
> There is a difference between functions implemented in Python and C.
> Functions implemented in Python are descriptors. They can be used for
> defining methods in Python classes. Functions implemented in C are not
> descriptors. When set a class attribute to a functions implemented in C,
> it will not become a bound method.

As it happens, the recently-created PEP 575 allows creating functions in 
C which behave more like Python functions.

It doesn't fix your use case with existing functions implemented in C or 
arbitrary callables but PEP 575 would fix your use case for 
user-implemented C functions.


More information about the Python-ideas mailing list