how to exclude specific things when pickling?
Michael Palmer
m_palmer45 at yahoo.ca
Sun Sep 14 11:06:44 EDT 2008
On Sep 14, 10:53 am, "inhahe" <inh... at gmail.com> wrote:
> If I gather correctly pickling an object will pickle its entire hierarchy,
> but what if there are certain types of objects anywhere within the hierarchy
> that I don't want included in the serialization? What do I do to exclude
> them? Thanks.
If your class defines a __getstate__ method, it is expected to return
the pickled state of the entire class. You can for example del those
items from self.__dict__ that you don't want pickled and then return
dumps(self).
More information about the Python-list
mailing list