[C++-sig] Pickle python subclass of C++ interface
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Sat Jul 17 23:38:43 CEST 2010
> Ok I'll give that a whirl. I was hoping to avoid doing __getinitargs__()
> for each subclass as I have quite a few of them. If I didn't have a C++
> base class then the pickling would just work as is. There's no way I
> can get back to that sort of situation with the C++ base class is there?
I don't know, but there may be. One (totally untested) idea would be to
give the base class __getstate__ and __setstate__ methods that inspect the
instance to re/store the state. Maybe you just need to return and restore
I guess you could mix-in the __getstate__, __setstate__ methods.
More information about the Cplusplus-sig