In article <rowen-df116b.12542704052...@news.gmane.org>, "Russell E. Owen" <ro...@uw.edu> wrote:
> What is the sequence of calls when unpickling a class with __setstate__? > > >From experimentation I see that __setstate__ is called and __init__ is > not, but I think I need more info. > > I'm trying to pickle an instance of a class that is a subclass of > another class that contains unpickleable objects. > > What I'd like to do is basically just pickle the constructor parameters > and then use those to reconstruct the object on unpickle, but I'm not > sure how to go about this. Or an example if anyone has one. The following seems to work, but I don't know why: def __getstate__(self): ...return the argument dict needed for __init__ def __setstate__(self, argdict): self.__init__(**argdict) -- Russell -- http://mail.python.org/mailman/listinfo/python-list