copy
copy — Shallow and deep copy operations
Source code: Lib/copy.py
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.er