Thanks also for your help! So taking into account that tree data structures can be created as a nested tuples...
Do you have any pointers on how to get from here continent = ["australia", "europe", "america", "asia"] country = [["spain", "germany", "belgium"], ["united states", "canada"]] state = ["california", "oregon", "arizona"] To here: geo=[ ("australia", []), ("europe", [("spain",[]), ("germany",[]), (belgium",[])]), ("north america", [("united states",[ ("california",[]), ("oregon",[]), ("arizona",[]) ]) ]), ("canada", []), ("asia", []) ] ?? Thanks Again! Lauren > > I think the normal way of representing a tree in python would be as > (value, children) tuples. > > In this case, you would have: > > geo = [('australia', []), ('europe', [('spain', []), ('germany', []), > ('belgium', [])]), > ('america', [('california', [('los angeles', []), ('san > francisco', [])]), > ('texas', [('detroit', [])])]), > # etc > ] > > This lets you avoid messy isinstance testing to figure out if you've > got a value or a list of children. > (admittedly, it can be hard to keep track of the brackets, but good > indentation and a monospaced font should help out) > > -- > John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor