Re: deepcopy does not work for A subclassed list
- From: MRAB <python@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 07 Oct 2011 21:37:00 +0100
On 07/10/2011 20:29, txismis unzetabarrenetxeagoikolea wrote:
This is the issueThe documentation talks about defining a "__deepcopy__" method.
I have created a mylist class by subclassing a List, added several
attributes to mylIst , and overrided the append method which takes into
account one of the new attributes.
mylist class is functional and works as I planned, but when I try to
deepcopy objects from mylist I received errors because the attribute has
not been copied and the override append raise an error.
When I want to deepcopy one object from mylist the algorithm does not
take into account the attributes I created; ergo, I have some errors
from the copy module
I can use pickle to dump and load objects from my subclass with no errors.
Any ideas about how to make the copy module to behave as expected.
- Prev by Date: Re: recommend a graphics library for plotting by the pixel?
- Next by Date: Re: Thread handling issue
- Previous by thread: Memory
- Next by thread: Re: deepcopy does not work for A subclassed list