当给出非字符串值来代替字符串占位符时,它不会产生错误,而当给出非整型或浮点值时,它就会产生错误。recent call last):TypeError: %d format: a number is required, not strmost recent call last):
File "<stdin>", line 1, in <modu
only called when inheriting from object
print issubclass(DemoClass, int)
本质上,继承不可变类会导致不可变类,Python通常使用基类原始值,而不是我精心设计的神奇方法。如果您想要的只是在实际创建对象之前修改对象的起始值,这是很好的,但我想避免不可变的诅咒。尝试使用object