Trying to understand pickle.loads withou class declaration

Philippe C. Martin philippe at philippecmartin.com
Sun May 29 10:10:16 EDT 2005


Thanks,

Philippe


Sébastien Boisgérault wrote:

> Even
> 
>     class A:
>         pass
> 
> should do the trick. Only the instance attributes are saved by a
> pickle,
> not the methods or the class itself. The unpickler tries to merge the
> saved data and the class/method info that is not saved to recreate
> the fully functional instance... but of course this info should still
> be available. The unpickler will even import the class from the
> appropriate module if necessary.
> 
> If you want your unpickler to manufacture a class for you when
> it is not available, you may use the gnosis xml pickler with the
> appropriate security ("paranoia") level.
> 
> http://gnosis.cx/download/gnosis/xml/pickle/
> 
> Cheers,
> 
> Seb




More information about the Python-list mailing list