POOP / Python (Object Oriented Persistence) ?

Andrew Kuchling akuchlin at mems-exchange.org
Tue Jul 11 12:26:10 EDT 2000


"Dirk-Ulrich Heise" <hei at adtranzsig.de> writes:
> Isn't this a very real problem? I mean, i could
> get around it using some export/import feature
> that saves to a certain file format i define.
> So i'd be writing save/load stuff myself again.
> So what do i gain using ZODB or pickle or whatever?

In ZODB versioning is handled by writing __getstate__/__setstate__
methods for your class that will convert old instances to the new
instance, by adding new attributes or whatever.  This means that if
you change classes a lot, your __getstate__ will slowly accrete more
complexity over time, but Jim Fulton argues that the burden isn't too
great.

Some OODBs automatically convert objects to the latest version when
the class is changed; this could probably be implemented on top of the
ZODB somehow, though there's currently no way to get all the instances
of a given class.  

--amk



More information about the Python-list mailing list