how to exclude specific things when pickling?

Christian Heimes lists at cheimes.de
Sun Sep 14 11:07:06 EDT 2008


inhahe 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.

Pickle uses the methods __getstate__, __setstate__ and __reduce__ / 
__reduce_ex__ to access certain aspects of an object like e.g. the 
state. You can find more information in the pickle docs.

Christian




More information about the Python-list mailing list