deepcopy does not work for A subclassed list

txismis unzetabarrenetxeagoikolea kurro.pipi at hotmail.com
Fri Oct 7 15:29:15 EDT 2011


This is the issue

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.

Thanks!

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20111007/e137fd5f/attachment.html>


More information about the Python-list mailing list