cPickle and subclassing lists?

Reckoner reckoner at gmail.com
Fri Apr 17 19:13:33 CEST 2009


I have a large class that is a child of list. I need to pickle it, but
it's not working. For example, I have reduced it to the following:

class Mylist(list):
    def __init__(self,x=[]):
	list.__init__(self,x)

and I cannot even get this to pickle right.

>> w=Mylist([1,2,3])
>> dumps(w)

PicklingError: Can't pickle <class '__main__.p'>: attribute lookup
__main__.p fa
iled


I'm using python 2.5 on win32.

any help appreciated.






More information about the Python-list mailing list