美文网首页
python error

python error

作者: LFBuildMountain | 来源:发表于2018-03-23 21:29 被阅读0次

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

      本文链接:https://www.haomeiwen.com/subject/mohfcftx.html