object persistency, store instances relationship externally
Fredrik Lundh
fredrik at pythonware.com
Fri Jul 25 07:54:34 EDT 2008
King wrote:
> This is a new test for object persistency. I am trying to store the
> relationship between instances externally.
> It's not working as expected. May be I am doing it in wrong way. Any
> suggestions?
The shelve module pickles each stored item individually. To preserve
inter-object relations, try putting all related things in a tuple, and
store that instead. E.g.
shelf['data'] = (a, lst)
a, lst = shelf['data']
</F>
More information about the Python-list
mailing list