copy.deepcopy question
Aahz
aahz at pythoncraft.com
Thu Nov 28 00:08:18 EST 2002
In article <3DD0BFED.B59F49D9 at ipm.fhg.de>,
Markus von Ehr <markus.vonehr at ipm.fhg.de> wrote:
>
>I have one object called Reference.
>Several Spectra objects include their own Reference object.
>To assign the Reference I want to pass the Reference object to
>several Spectra objects which have to make a copy to a member variable.
>Every Spectra need its own copy because different Spectras may have
>different References.
>
>Is copy.deepcopy the right way to copy the Reference object to
>a Spectras member variable?
Depends. Just how independent should each Spectra's Reference be? For
example, if a Reference contains a binding to a class instance, should
that instance object be shared among multiple References? You might be
better off making Reference(<Reference instance>) a copy creator of some
kind.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"If you don't know what your program is supposed to do, you'd better not
start writing it." --Dijkstra
More information about the Python-list
mailing list