summaryrefslogtreecommitdiff
path: root/examples/adjacencytree/byroot_tree.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2005-10-14 09:35:29 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2005-10-14 09:35:29 +0000
commit95e75a7cf8fc7d5ecaa631821080866024e35b3a (patch)
tree2a9d6f0c266b67271b641dbc1abed436e69b8f06 /examples/adjacencytree/byroot_tree.py
parenta27611d414c5919561a4e6fd77893b472e652c6e (diff)
downloadsqlalchemy-95e75a7cf8fc7d5ecaa631821080866024e35b3a.tar.gz
Diffstat (limited to 'examples/adjacencytree/byroot_tree.py')
-rw-r--r--examples/adjacencytree/byroot_tree.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/adjacencytree/byroot_tree.py b/examples/adjacencytree/byroot_tree.py
index 06b74d7b7..a98b19368 100644
--- a/examples/adjacencytree/byroot_tree.py
+++ b/examples/adjacencytree/byroot_tree.py
@@ -9,9 +9,10 @@ import string, sys
add application-specific functionality to a Mapper object."""
class NodeList(util.OrderedDict):
- """extends an Ordered Dictionary, which is just a dictionary that returns its keys and values
- in order upon iteration. Adds functionality to automatically associate
- the parent of a TreeNode with itself, upon append to the parent's list of child nodes."""
+ """extends an Ordered Dictionary, which is just a dictionary that iterates its keys and values
+ in the order they were inserted. Adds an "append" method, which appends a node to the
+ dictionary as though it were a list, and also within append automatically associates
+ the parent of a TreeNode with itself."""
def __init__(self, parent):
util.OrderedDict.__init__(self)
self.parent = parent
@@ -35,8 +36,8 @@ class TreeNode(object):
def __init__(self, name):
"""for data integrity, a TreeNode requires its name to be passed as a parameter
to its constructor, so there is no chance of a TreeNode that doesnt have a name."""
- self.children = NodeList(self)
self.name = name
+ self.children = NodeList(self)
self.root = self
self.parent = None
self.id = None