'''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.'''
淺復(fù)制和深復(fù)制之間的區(qū)別僅與
復(fù)合對(duì)象(包含其他對(duì)象的對(duì)象,例如列表或
類實(shí)例)。
-淺表副本會(huì)構(gòu)造一個(gè)新的復(fù)合對(duì)象,然后(到
在可能的范圍內(nèi))插入相同的對(duì)象
原始包含。
-深層副本會(huì)構(gòu)造一個(gè)新的復(fù)合對(duì)象,然后遞歸地
將原始文檔中找到的對(duì)象的“副本”插入其中。