__slots__
class Student(object):
__slots__ = ('name', 'age') # 用tuple定义允许绑定的属性名称
__slots__
class Student(object):
__slots__ = ('name', 'age') # 用tuple定义允许绑定的属性名称
本文标题:Python限制属性
本文链接:https://www.haomeiwen.com/subject/ymvwbxtx.html
网友评论