python error

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

你可能感兴趣的:(python error)