class test :
def fn(self, i):
#test.fn.f = 0 the "compiler" show "not define" errors
#self.fn.f = 0 the "compiler" show "not define" errors
return test.fn.f #ok
return self.fn.f #ok
fn.f = 1
p = test()
print p.fn(1)
「fn」メソッドで属性の値を変更できない理由が気になります
本質的に、それは...
test.fn.f
との違いは何self.fn.f
ですか? 関数の属性値を変更しても問題ないと確信していますが、なぜメソッドでそれを行うことができるのでしょうか?