programming unlimited "categories" in python ?
gabriel_ambuehl at buz.ch
Tue Oct 23 18:29:21 CEST 2001
-----BEGIN PGP SIGNED MESSAGE-----
Tuesday, October 23, 2001, 6:08:48 PM, you wrote:
> i think the key in what he is asking is that he is not talking
> about ONE tree.
So he want's to have like relational trees? Sounds like serious fun
> what if i have the followinf:
> 1- africa
> 1.1 mozambique
> 1.1.1 capital
> 1. deadly
> 1.1 next 5 hours
> 1.2 next ten days
> and you want a query like '5 hours deadly in africa'
You still need a link between the two, else you haven't got any
to match them anyway so why not just build the region tree and store
all the data under it? then you query for africa first and fetch only
the results which have got the attribute deadly in 5 hours?
> problems with this:
> a) the categorization is not stored in the object, but in the tree
> that points at it. not so big a deal in SQL (you can select from
> all_trees where objectid = self), but what about python? how would
> you implement it?
I wasn't thinking about the implementation itself but mostly about
suitable approaches. IMHO, you should try to squeeze your data model
into ONE tree and the problem is almost solved.
> b) africa can be pretty big. shouldnt i be able to get/(build?) the
> region tree under any node of the others? something like olap.
Uuh? Of course you can have africa as a subtree of some other tree if
you use some sort of generic tree class like:
[some class] data
(pointer to parent)
(pointer to next sibling)
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5i
-----END PGP SIGNATURE-----
More information about the Python-list