Overview
-
With the following assignment statement
b = a
Python will not make a copy of the object as referenced to by identifier "a"
and make the identifier "b" to to reference the newly created copy.
- Using the assignment operator Python will only copy the reference contained in identifier "a" to identifier "b". This makes the identifier "b" as well to reference to the original object referenced to by "a".
- To facilitate copying of objects python standard library has defined the copy functions in the module "copy".
The python module copy has the following functions:
Returns a shallow copy of the object that is passed as the parameter |
|
Returns a deep copy of the object that is passed as the parameter |