浅拷贝与深拷贝

'''The difference between shallow and deep copying is only relevant for
compound objects (objects that contain other objects, like lists or
class instances).

  • A shallow copy constructs a new compound object and then (to the
    extent possible) inserts the same objects into it that the
    original contains.

  • A deep copy constructs a new compound object and then, recursively,
    inserts copies into it of the objects found in the original.'''

浅复制和深复制之间的区别仅与
复合对象(包含其他对象的对象,例如列表或
类实例)。

-浅表副本会构造一个新的复合对象,然后(到
在可能的范围内)插入相同的对象
原始包含。

-深层副本会构造一个新的复合对象,然后递归地
将原始文档中找到的对象的“副本”插入其中。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容