@property
来源:互联网 发布:js异步完成执行函数 编辑:程序博客网 时间:2024/06/15 11:46
@property装饰器负责把一个方法变成属性调用
class Screen(object): @property def width(self): return self.__width @width.setter def width(self,value): self.__width = value @property def height(self): return self.height @height.setter def height(self,value): self.__height = value @property def resolution(self): return self.__width * self.__height# test:s = Screen()s.width = 1024s.height = 768print(s.resolution)assert s.resolution == 786432, '1024 * 768 = %d ?' % s.resolution
0 0
- property
- property
- Property
- @property
- @property
- property
- @property(..,..)
- property
- @property
- property
- property
- @property
- property()
- @property
- property
- @property
- property
- @property
- 实测CC2530 OSAL睡眠唤醒时间、电流、功耗
- [Nutch]Nutch抓取过程中生成的目录内容分析
- 泛型与递归的概述
- 目标检测的图像特征提取之(三)Haar特征
- 【LeetCode】13. Roman to Integer
- @property
- HDU 1236 排名(一大波输入)
- 查看修改mysql编码方式
- leetcode-169. Majority Element
- 【字符串】HDU5590ZYB's Biology【BestCoder Round #65】
- 计算机视觉目标检测的框架与过程
- 图片拉伸的方法
- 第八周总结及H5、Js实现五子棋效果
- 【Http专题】基础