copy
copy — Shallow and deep copy operations
Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy is sometimes needed so one can change one copy without changing the other. This module provides generic shallow and deep copy operations (explained below).
Interface summary:
-
copy.copy(x)
-
Return a shallow copy of x.
-
copy.deepcopy(x)
-
Return a deep copy of x.
-
exception copy.error
-
Raised for module specific errors.
The difference between shallow and deep copying is only relevant for compound objects (objects that contain