Section summary
Important things to remember:
- the
deepcopy()
method creates and persists new instances of source objects, whereas any shallow copy operation only stores references to the original memory address; - a deep copy operation takes significantly more time than any shallow copy operation;
- the
deepcopy()
method copies the whole object, including all nested objects; it’s an example of practical recursion taking place; - deep copy might cause problems when there are cyclic references in the structure to be copied.