Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109866 > unrolled thread

loading trees...

Started byFillmore <fillmore_remove@hotmail.com>
First post2016-06-12 14:55 -0400
Last post2016-06-14 20:51 -0700
Articles 4 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  loading trees... Fillmore <fillmore_remove@hotmail.com> - 2016-06-12 14:55 -0400
    Re: loading trees... Michael Selik <michael.selik@gmail.com> - 2016-06-13 01:10 +0000
    Re: loading trees... dieter <dieter@handshake.de> - 2016-06-13 09:06 +0200
    Re: loading trees... Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-14 20:51 -0700

#109866 — loading trees...

FromFillmore <fillmore_remove@hotmail.com>
Date2016-06-12 14:55 -0400
Subjectloading trees...
Message-ID<njkb7r$9na$1@gioia.aioe.org>
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?

or maybe I am just reinventing the wheel and there are better ways to achieve this?

The idea is that I'll receive a bit of data, determine which tree is suitable for handling it,
and dispatch the data to the right tree for further processing...

Thanks

[toc] | [next] | [standalone]


#109875

FromMichael Selik <michael.selik@gmail.com>
Date2016-06-13 01:10 +0000
Message-ID<mailman.24.1465780230.2288.python-list@python.org>
In reply to#109866
On Sun, Jun 12, 2016 at 3:01 PM Fillmore <fillmore_remove@hotmail.com>
wrote:

> What's my best way to achieve this?
>

What are your criteria for "best"?


> The idea is that I'll receive a bit of data, determine which tree is
> suitable for handling it, and dispatch the data to the right tree for
> further processing.
>

How do you determine which tree is suitable? Does it require knowledge of
the whole tree? How big are the trees? How long does pickle take to load
those trees? How frequently does data arrive? How long does it take you to
determine the tree? How long is acceptable?

[toc] | [prev] | [next] | [standalone]


#109890

Fromdieter <dieter@handshake.de>
Date2016-06-13 09:06 +0200
Message-ID<mailman.29.1465801593.2288.python-list@python.org>
In reply to#109866
Fillmore <fillmore_remove@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").

[toc] | [prev] | [next] | [standalone]


#109954

FromLawrence D’Oliveiro <lawrencedo99@gmail.com>
Date2016-06-14 20:51 -0700
Message-ID<677537e8-b0d3-418e-a1a2-3417b5ee9578@googlegroups.com>
In reply to#109866
On Monday, June 13, 2016 at 6:56:07 AM UTC+12, Fillmore wrote:
> 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.

Store it in JSON form?

I like language-neutral solutions.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web