<div dir="ltr"><div>This is about the `copy.deepcopy` function.</div><div><br></div><div>With the __deepcopy__ method, user-defined objects can specify how they will be copied. But it is assumed that you will always want to copy them the same way. What if sometimes you want to copy them in one way and sometimes in another?</div>

<div><br></div><div>I am now being held back by this limitation. I will give some background to what I'm doing:</div><div><br></div><div><div>I'm developing a simulations framework called GarlicSim. You can see a short video here:</div>
<div><a href="http://garlicsim.org/brief_introduction.html">http://garlicsim.org/brief_introduction.html</a></div><div>The program handles world states in simulated worlds. To generate the next world state in the timeline, the last world state is deepcopied and then modified.</div>
</div><div><br></div><div>Now sometimes in simulations there are big, read-only objects that I don't want to replicate for each world state. For example, a map of the environment in which the simulation takes place. So I have defined a class called `Persistent`, for which I have defined a __deepcopy__ that doesn't actually copy it, but gives a reference to the original object. So now I can use `Persistent` as a sub-class to these big objects that I don't want to replicate.</div>
<div><br></div><div>But in some cases I do want to replicate these objects, and I can't!</div><div><br></div>
<div>So I suggest that it will be possible to specify a "mode" for copying. User defined objects will be able to specify how they will be deepcopied in each mode.</div><div><br></div><div>What do you think?</div>
<div><br></div><div><br></div><div>Ram.</div><div><br></div></div>