Differentiate between deep and shallow copies.

Last updated 3 weeks, 5 days ago | 20 views 75     5

Tags:- Python

Python | Deep and Shallow copies

  • Shallow copy does the task of creating new objects and storing references to original elements. This does not undergo recursion to create copies of nested objects. It just copies the reference details of nested objects.
  • Deep copy creates an independent and new copy of an object and even copies all the nested objects of the original element recursively.