This is my code. I don’t know why it doesn’t work.
class a:
def __get__(self):
return 'xxx'
def aa(self):
print 'aaaa'
b=a()
print b.get('aa')
Please try to answer in code, because my English is not very good. Thank you.
class HideX(object):
def __init__(self, x):
self.x = x
def get_x(self):
return self.__x
def set_x(self, x):
self.__x = x+10
x = property(get_x, set_x)
inst = HideX(20)
print inst.x
inst.x = 30
print inst.x
You are calling
obj.get, but there is no get function inclass A, hence error,either rename
__get__togetor if you by chance are trying to use descriptors do something like this