In Python, when you do assign one list variable to another, it actually assigns an extra reference to the same list object, thus making any modification to one of variables be effectively reflected by another. This is what called "a shallow copy".
Sometimes, it's not the intent and you really want to obtain two independent copies of the list object, that's what called "a deep copy". Omitting trivial iterative by-element copy, there is at least three proper ways to create a deep copy of the list object.
- Invoking a builtin function named copy.deepcopy() which is designed to do deep copies of anything and - duh - applicable to lists;
- Calling list constructor on the source object: a = list(b), which is nice, because it's clear and costs only six bytes of code;
- And finally, making full slice of the source object: a = b[::], which might be not as fast as approach №2, but it's only four bytes of code!