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'
爲什麼實例沒有屬性x
?
{'myVersion':'1.0'}是不是歸屬?爲什麼實例沒有屬性?