Discuss / Python / 只有在类定义的时候__slots__才有效?定义完了之后再绑定类属性无效?

只有在类定义的时候__slots__才有效?定义完了之后再绑定类属性无效?

Topic source

zhang20142014

#1 Created at ... [Delete] [Delete and Lock User]

class Student(object): pass Student.slots=('name','age') zhang=Student() zhang.score=88 '输出88 zhang.slots '输出('name','age')

```


  • 1

Reply