Python.__getattr__Vs__getattribute__
摘要:
__getattr__ Vs __getattribute__ 1 class Fish(object): 2 3 def __getattr__(self, key): 4 if key == 'color': 5 print 'access color' 6 return 'blue' 7 else: 8 raise AttributeError 9 10 def __getattribute__(self, key):11 p... 阅读全文
posted @ 2013-10-17 23:33 XiaoKL 阅读(380) 评论(0) 推荐(0) 编辑