What is the difference Between a Shallow Copy and Deep Copy?
- Naveen
- 0
Deepcopy
Deepcopy creates a different object and populates it with the child objects of the original object.
Therefore, changes in the original object are not reflected in the copy.
copy.deepcopy() creates a Deep Copy.
Shallow copy
Shallow copy creates a different object and populates it with the references of the child objects within the original objects.
Therefore, changes in the original object are reflected in the copy.
copy.copy creates a Shallow Copy.
Popular Posts
Spread the knowledge