1. Shallow copy
1> assignment: From the following example we can see that the memory address of the new variable after the assignment has not changed, in fact, the assignment operation in Python does not open up new memory space, it just copies the reference of the new object, that is, in addition to the name of B, there is no other memory overhead, If you modify the value of a, it will affect the value of B, similarly, if you modify the value of B, it will also affect the value of a.
2> a shallow copy is a copy of the reference, it only copies the sub-object, so that ID (a)!=id (c), then the resource inside the object is still a reference, so the internal ID (a[0]) ==id (c[0]), ID (a[2][0]) ==id (c[2][0]), If there are nested elements, modify the values of the shallow copy, and the original variable is also modified
2. Deep copy
A deep copy is a copy of an object resource, ID (a)!=id (d), and its internal resources are not nested. ID (a[0]) ==id (d[0]), if there is a nested case, ID (a[2])!=id (d[2])
All parameters are passed by reference in Python.
If you modify the parameters in the function, the original parameters are changed.
The original list will be changed after the list has been manipulated.
Shallow copy and deep copy of Python