Re: [Tutor] building nonbinary trees

2005-11-17 Thread Alan Gauld
> I'v got a start but I'm stuck because I don't understand how to call > a tree's nodes by name. Every time you see call by name, think dictionary. class Node: def __init__(self): self.children = {} def addChild(self,child,name): self.children[name] = child etc.

Re: [Tutor] building nonbinary trees

2005-11-17 Thread Liam Clarke-Hutchinson
Erm, a dictionary of names to references? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vincent Wan Sent: Friday, 18 November 2005 2:21 p.m. To: tutor@python.org Subject: [Tutor] building nonbinary trees I would like to have a tree data structure

[Tutor] building nonbinary trees

2005-11-17 Thread Vincent Wan
I would like to have a tree data structure with trees whose nodes could have an arbitrary number of descendants and that I could iterate over by the names of nodes I'v got a start but I'm stuck because I don't understand how to call a tree's nodes by name. Here is the code I have so far: i