python error
2018-03-23 本文已影响0人
LFBuildMountain
the article records small errors I met when I use python, which reflects some easily-ignored python grammar .they all cost me some time to look for solutions on Google, StackOverflow and etc. I wish it will help someone with same issue :)
class Test:
hello="class variable"
hey = "hey class variable"
c1 = Test()
c2 = Test()
del c1.hello
print(Test.__dict__)
error
Traceback (most recent call last):
del c1.hello
AttributeError: hello
[Finished in 0.2s with exit code 1]
reason
class variable reference can't be deleted via a instance
del Test.hello