Robert Latest via Python-list wrote: > I found a workaround using a wrapper method which calls a C function, > passing the instance as a separate argument. It works, and I cannot see > any disadvantage. It's just not as elegant as I'd like it to be, and I > don't understand WHY the C "method" doesn't receive a pointer to the > Python instance. Maybe somebody can clarify.
I don't know much about the C-implementation side, but functions written in Python are also descriptors. Given def f(self): pass class A(object): m = f c = abs v = 42 a = A() a seemingly simple attribute access m = a.m # m is now a bound method invokes f.__get__(a, A) under the hood while m = a.c assert m is abs just returns the function (abs in the example) the same way it returns any other value: v = a.v assert v == 42 -- https://mail.python.org/mailman/listinfo/python-list