12 Apr
2018
12 Apr
'18
2:32 p.m.
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.