2 ms·
No, because the text really should be that a.some_function() is transformed to a.__class__.some_function(a). There's no way to get to the function except throug
by dalke 16y ago
No, because the text really should be that a.some_function() is transformed to a.__class__.some_function(a). There's no way to get to the function except through dots or circumlocutions like 'getattr'.
There are some exceptions which make the above only an approximation. For example, if 'some_function' happens to be a function bound to the instance rather than the class. (def spam(): pass; instance.spam = spam; instance.spam() ) The result here is not the same as instance.__class__.spam(self) .