#测试property,x.setter,x.deleter
class Test1:
def __init__(self):
self.__private = "alex" @property
def private(self):
return self.__private @private.setter
def private(self,value):
self.__private = value @private.deleter
def private(self):
del self.__private t1 = Test1()
print(t1.private)
t1.private = "alex2"
print(t1.private)
del t1.private
print(t1.private)
相关文章
- 01-23python字符串反转 高阶函数 @property与sorted(八)
- 01-23python 3全栈开发-面向对象之绑定方法(classmethod与staticmethod的区别)、多态、封装的特性property
- 01-23MTK 添加与APK通信的property
- 01-23util:properties与context:property-placeholder
- 01-23python之中特性(attribute)与属性(property)有什么区别?
- 01-23property与x.setter与x.deleter
- 01-23@ property 与@ synthesize 的作用 VS @interface
- 01-23面向对象 - 封装,隐藏属性,property,绑定与非绑定方法,元类
- 01-23@property与内存管理以及可传参数
- 01-23Angular2+中Property 'length' does not exist on type 'never' 问题的原因与解决办法