python的描述符(descriptor)、装饰器(property)造成的一个无限递归问题分享
分享一下刚遇到的一个小问题,我有一段类似于这样的python代码:
#coding:utf-8
classA(object):
@property def_value(self): # raiseAttributeError("test") return{"v":"Thisisatest."}
def__getattr__(self,key): print"__getattr__:",key returnself._value[key]
if__name__=='__main__': a=A() printa.v