Python Language Copying data Performing a deep copy


Example

If you have nested lists, it is desireable to clone the nested lists as well. This action is called deep copy.

>>> import copy
>>> c = [[1,2]]
>>> d = copy.deepcopy(c)
>>> c is d
False
>>> c[0] is d[0]
False