淺拷貝與深拷貝

'''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ì)象的“副本”插入其中。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 本文翻譯自 Assignment, Shallow Copy, Or Deep Copy?作者:Weilin L...
    耐心的農(nóng)夫2020閱讀 373評(píng)論 0 0
  • python中包含復(fù)制 淺拷貝與深拷貝 1.復(fù)制 復(fù)制沒有拷貝子對(duì)象,未開辟新內(nèi)存空間,也沒有產(chǎn)生新object,...
    Pello_Luo閱讀 495評(píng)論 0 0
  • 什么是淺拷貝與深拷貝。淺拷貝就是不可變對(duì)象執(zhí)行不可變拷貝(copy)深拷貝就是如果執(zhí)行拷貝時(shí) 只要有可變的無論是可...
    KingChoo閱讀 406評(píng)論 0 0
  • 定義 淺拷貝(shallow copy):只復(fù)制指向某個(gè)對(duì)象的指針,而不復(fù)制對(duì)象本身,新舊對(duì)象共享一塊內(nèi)存。深拷貝...
    YoungEvita閱讀 294評(píng)論 0 1
  • 推薦指數(shù): 6.0 書籍主旨關(guān)鍵詞:特權(quán)、焦點(diǎn)、注意力、語(yǔ)言聯(lián)想、情景聯(lián)想 觀點(diǎn): 1.統(tǒng)計(jì)學(xué)現(xiàn)在叫數(shù)據(jù)分析,社會(huì)...
    Jenaral閱讀 5,998評(píng)論 0 5

友情鏈接更多精彩內(nèi)容