class Test():
myVersion="1.0"
t=Test()
t.myVersion
--> 1.0
Test.myVersion="2.0"
Test.x={'myVersion':'1.0'}
Test.x
--> {'myVersion': '1.0'}
t.x
--> {'myVersion': '1.0'}
del t.x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: Test instance has no attribute 'x'
为什么实例 t 没有属性x
?
{'myVersion': '1.0'} 是不是归属地?