convert flat structure into hierarchical one

Ksenia Marasanova ksenia at ksenia.nl
Mon Sep 27 10:44:31 EDT 2004


Thanks to all for helpfull suggestions!
I think I'll use the tree class as Dan suggested, but instead of 
creating the list of node instances in advance, will do it on demand. 
I'll use the function of Mike in the constructor of the  tree, and will 
use the resulting data for internal tree searching and node generation. 
I think it's much faster then creating all the node instances from the 
beginning, and I actually seldom need a whole three, only parts of it.

And no, it's not a genealogical structure :).. I used words as 'parent' 
and 'child' just to explain the tree structure better. It's for a 
website, where all navigation parts are stored in one tree. Until now, 
I had a recursive SQL function in PostgreSQL, but with the growing of 
the tree (hey, it's alive! ;-) the function is getting slower, so I 
want to move it to Python.

Ksenia.




More information about the Python-list mailing list