\section{\module{copy} ---
- Shallow and deep copy operations.}
+ Shallow and deep copy operations}
\declaremodule{standard}{copy}
\modulesynopsis{Shallow and deep copy operations.}
-\withsubitem{(in module copy)}{%
- \ttindex{copy}%
- \ttindex{deepcopy}}
This module provides generic (shallow and deep) copying operations.
+\withsubitem{(in copy)}{\ttindex{copy()}\ttindex{deepcopy()}}
Interface summary:
to control pickling: they can define methods called
\method{__getinitargs__()}, \method{__getstate__()} and
\method{__setstate__()}. See the description of module
-\module{pickle}\refstmodindex{pickle} for information on these
+\refmodule{pickle}\refstmodindex{pickle} for information on these
methods. The \module{copy} module does not use the \module{copy_reg}
registration module.
-\withsubitem{(copy protocol)}{%
- \ttindex{__getinitargs__()}%
- \ttindex{__getstate__()}%
- \ttindex{__setstate__()}}
+\withsubitem{(copy protocol)}{\ttindex{__getinitargs__()}
+ \ttindex{__getstate__()}\ttindex{__setstate__()}}
In order for a class to define its own copy implementation, it can
define special methods \method{__copy__()} and
implementation needs to make a deep copy of a component, it should
call the \function{deepcopy()} function with the component as first
argument and the memo dictionary as second argument.
-\withsubitem{(copy protocol)}{%
- \ttindex{__copy__()}%
- \ttindex{__deepcopy__()}}
+\withsubitem{(copy protocol)}{\ttindex{__copy__()}\ttindex{__deepcopy__()}}
\begin{seealso}
\seemodule{pickle}{Discussion of the special disciplines used to