Please can anyone give a detailed explanation of the difference between the methods "copy and deepcopy" in python3 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please can anyone give a detailed explanation of the difference between the methods "copy and deepcopy" in python3

21st Nov 2016, 7:47 AM
Ifeakor Nnaemeka
Ifeakor Nnaemeka - avatar
2 Answers
+ 1
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 references into it to the objects found in the original.
21st Nov 2016, 8:30 AM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
+ 1
@ TechTro Thanks
21st Nov 2016, 8:54 AM
Ifeakor Nnaemeka
Ifeakor Nnaemeka - avatar