代码:
class C:
def __init__(self, **kwargs):
self.w = 'foo'
self.z = kwargs['z']
self.my_function(self.z)
def my_function(self, inp):
inp += '!!!'
input_args = {}
input_args['z'] = 'bar'
c = C(**input_args)
print c.z
预期结果
bar!!!
实际结果
bar
你如何在init中调用一个类的方法?