Re: Recursive tree list from dictionary

2006-01-14 Thread David Pratt
Hi Bengt! I have been banging my head on this one all day! This is brilliant (and recursive through each level which is exactly what I was trying to work out)! Only part I needed to modify is else: return title to else: return [title] I tell you, you've made my day! I was getting a bit discou

Re: Recursive tree list from dictionary

2006-01-14 Thread Bengt Richter
On Sat, 14 Jan 2006 16:46:29 -0400, David Pratt <[EMAIL PROTECTED]> wrote: >Hi Allan, Max, and bearophile > >Many thanks for your replies to this. The number of levels can be deeper >than two for creating child, sibling relationships. This can lead to >futher nesting as shown in my sample result

Re: Recursive tree list from dictionary

2006-01-14 Thread David Pratt
Hi Allan, Max, and bearophile Many thanks for your replies to this. The number of levels can be deeper than two for creating child, sibling relationships. This can lead to futher nesting as shown in my sample result list (the result I am attempting to acheive) which is reason that I believe thi

Re: Recursive tree list from dictionary

2006-01-14 Thread Alan Franzoni
Il Sat, 14 Jan 2006 13:52:43 -0400, David Pratt ha scritto: > source_list =[ I don't understand what you mean by saying that 'levels of categorization is not fixed', are there more than two keys in any dictionary? Basically, thus, you have a list of dictionaries and you want to get a list of lis

Re: Recursive tree list from dictionary

2006-01-14 Thread bearophileHUGS
This isn't much tested, so don't trust it much, and I hope it's not overkill. You can find Graph here: http://sourceforge.net/projects/pynetwork/ With this you can plot the tree, if you want: g.springCoords(); g.plot2d() Bear hugs, bearophile def scan(g, parent): subs = [scan(g, sub) for sub

Re: Recursive tree list from dictionary

2006-01-14 Thread Max Erickson
David Pratt <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Hi. I am wanting to create a tree list result structure from a > dictionary to categorize results. The dictionary contains elements > that identify its parent. The levels of categorization is not fixed, > so there is a need for t

Recursive tree list from dictionary

2006-01-14 Thread David Pratt
Hi. I am wanting to create a tree list result structure from a dictionary to categorize results. The dictionary contains elements that identify its parent. The levels of categorization is not fixed, so there is a need for the code to be recursive to drill down to the lowest level. I have contri