会员
周边
众包
新闻
博问
闪存
赞助商
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
nevermore_29
Everything will be ok in the end, if it is not ok, it is not in the end!
博客园
首页
新随笔
联系
管理
订阅
2019年5月13日
使用@property
摘要: 使用@property 在绑定属性时,如果我们直接把属性暴露出去,虽然写起来很简单,但是,没办法检查参数,导致可以把成绩随便改: s = Student() s.score = 9999 这显然不合逻辑。为了限制score的范围,可以通过一个set_score()方法来设置成绩,再通过一个get_s
阅读全文
posted @ 2019-05-13 10:16 nevermore_29
阅读(100)
评论(0)
推荐(0)
编辑
公告