09 2013 档案
摘要:1 class Test: 2 def __getattr__(self, name): 3 print name, 4 return self 5 6 def __call__(self, *args, **kwargs): 7 print "call", args, kwargs, 8 return self 9 10 t = Test()11 #输出xxx call ('x',) {} yyy call ('y',) {'m': 1, 'n': 'nnnn'} zzz call () {}
阅读全文