Removed parent attribute to avoid cyclic references between nodes.

parent 003a9e25
......@@ -4,10 +4,6 @@
class Node(object):
def __init__(self, value, *nodes):
self.value, self.nodes = value, list(nodes)
self.parent = None
for a in self.nodes:
a.parent = self
def __getitem__(self, n):
return self.nodes[n]
......@@ -38,7 +34,6 @@ class Node(object):
class Leaf(Node):
def __init__(self, value):
self.value = value
self.parent = None
self.nodes = None
def __len__(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment