[Python-ideas] Being able to specify "copy mode" to copy.deepcopy

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Dec 15 23:24:06 CET 2009

cool-RR wrote:

> 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?

Then you need to define your own system of copying methods
and implement them appropriately for the classes they apply

The deepcopy mechanism is only designed to cover simple
cases. It isn't, and can't be, all things to all people.


More information about the Python-ideas mailing list