因此,我有一个函数(让我们称之为fun1),它接受一个函数作为参数。但是在fun1内部,我需要访问参数的__self__,只有在函数是绑定方法的情况下才存在参数的__self__。# Some logic on the "o" object, such as logging the object's class,
# doing some inspection,如果我像上面那样使用MyFuncType,PyCharm会抱怨__self__</
在这个答案中,@aix提供了一种使用装饰器重置回忆录函数的很好的方法。c = my_class()# This time the function is computed and stored我有一个不能完全说服的半解决方案,但我想有人可以改进。我修改了reset()方法并引入了一个参数instance
def _reset(self,instance<