class C(object):
def __init__(self):
self.__x = None
@property
def x(self):
"""I'm the 'x' property."""
return self.__x
@x.setter
def x(self, value):
self.__x = value
@x.deleter
def x(self):
# del self.__x
self.__x = None
if __name__=="__main__":
c = C()
print c.x
c.x = 1
print c.x
del c.x
# c.x = 1
print c.x
>> None
>> 1
>> None
http://www.runoob.com/python/python-func-property.html
https://segmentfault.com/a/1190000007984750
https://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001386820062641f3bcc60a4b164f8d91df476445697b9e000