摘要: # 限制实例的属性?比如,只允许对Student实例添加name和age属性。 class Student(object): __slots__ = ('name', 'age') # 用tuple定义允许绑定的属性名称 阅读全文
posted @ 2021-09-16 17:32 LiShiChao 阅读(26) 评论(0) 推荐(0) 编辑