python @property @x.setter

class a:
    @property
    def x(self):
        return 1

    @x.setter
    def x(self,value):
        pass

a1= a()
y = a1.x
print(y)
a1.x = 2
print(y)
1
1
原文地址:https://www.cnblogs.com/DDBD/p/13895693.html