Help on module copy:
NAME
copy-Generic (shallowanddeep) copying operations.
FILE
c:\python31\lib\copy.py
DESCRIPTION
Interface summary:importcopy
x=copy.copy(y)#make a shallow copy of yx=copy.deepcopy(y)#make a deep copy of yFor module specific errors, copy.Errorisraised.
The difference between shallowanddeep copyingisonly relevantforcompound objects (objects that contain other objects, like listsorclassinstances).-A shallow copy constructs a new compound objectandthen (to the
extent possible) inserts*the same objects*into it that the
original contains.-A deep copy constructs a new compound objectandthen, recursively,
inserts*copies*into it of the objects foundinthe original.
Two problems often exist with deep copy operations that don't existwith shallow copy operations:
a) recursive objects (compound objects that, directlyorindirectly,
contain a reference to themselves) may cause a recursive loop
b) because deep copy copies*everything*it may copy too much, e.g.
administrative data structures that should be shared even between
copies
Python's deep copy operation avoids these problems by:a) keeping a table of objects already copied during the current
copyingpassb) letting user-defined classes override the copying operationorthe
set of components copied
This version doesnotcopy types like module,class, function, method,
nor stack trace, stack frame, nor file, socket, window, nor array, nor
any similar types.
Classes can use the same interfaces to control copying that they use
to control pickling: they can define methods called__getinitargs__(),__getstate__()and__setstate__(). See the documentationformodule"pickle"forinformation on these methods.
CLASSES
builtins.Exception(builtins.BaseException)
Error
... ...
FUNCTIONS
copy(x)
Shallow copy operation on arbitrary Python objects.
See the module's __doc__ string for more info.deepcopy(x, memo=None, _nil=[])
Deep copy operation on arbitrary Python objects.
See the module's __doc__ string for more info.DATA__all__=['Error','copy','deepcopy']