On 10/7/2011 4:37 PM, MRAB wrote:
On 07/10/2011 20:29, txismis unzetabarrenetxeagoikolea wrote:

Any ideas about how to make the copy module to behave as expected.

The documentation talks about defining a "__deepcopy__" method.

Specifically, in the copy module doc
"In order for a class to define its own copy implementation, it can define special methods __copy__() and __deepcopy__(). The former is called to implement the shallow copy operation; no additional arguments are passed. The latter is called to implement the deep copy operation; it is passed one argument, the memo dictionary. If the __deepcopy__() implementation needs to make a deep copy of a component, it should call the deepcopy() function with the component as first argument and the memo dictionary as second argument."

All the possible customization methods are discussed in Language Reference 3.3. Special method names

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to