Python: deepcopy does not work on user-defined classes?

落花浮王杯 提交于 2019-11-29 13:32:46

Deep copying (by default) only applies to instance level attributes - not class level - It doesn't make much sense that there's more than one unique class.attribute...

Change your code to:

class Test:
    def __init__(self):
        self.field = [(1,2)]
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!