loading trees...

dieter dieter at handshake.de
Mon Jun 13 03:06:24 EDT 2016


Fillmore <fillmore_remove at hotmail.com> writes:

> Hi, problem for today. I have a batch file that creates "trees of data".
> I can save these trees in the form of python code or serialize them with something
> like pickle.
>
> I then need to run a program that loads the whole forest in the form of a dict()
> where each item will point to a dynamically loaded tree.
>
> What's my best way to achieve this? Pickle? or creating curtom python code?

Not sure about the "best". But one possibility would be to use the
"ZODB" ("Zope Object DataBase").

The "ZODB" allows you to store rooted graph like data structures
(among them forests) persitently. Nodes in this graph are loaded
dynamically (and cached).

It would be a bit difficult to use Python "dict"s directly, but
the ZODB comes with "dict" like data structures which play well
with the ZODB persistency (e.g. "BTrees.OOBTree").




More information about the Python-list mailing list