Mercurial > hg > config
comparison python/tree.py @ 426:866c5b1bc4e8
stubbing
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Tue, 06 Aug 2013 18:30:15 -0700 |
| parents | 5417eb6364ee |
| children | 9b7f5e31b465 |
comparison
equal
deleted
inserted
replaced
| 425:5417eb6364ee | 426:866c5b1bc4e8 |
|---|---|
| 44 class Tree(object): | 44 class Tree(object): |
| 45 """tree structure in python""" | 45 """tree structure in python""" |
| 46 | 46 |
| 47 def __init__(self, parent=None): | 47 def __init__(self, parent=None): |
| 48 self.parent = parent | 48 self.parent = parent |
| 49 self._children = [] | |
| 49 | 50 |
| 50 def children(self): | 51 def children(self): |
| 51 """returns children of the tree""" | 52 """returns children of the tree""" |
| 53 return self._children # base implementation | |
| 52 | 54 |
| 53 def add(self, item): | 55 def add(self, item): |
| 54 """add a child to the tree root""" | 56 """add a child to the tree root""" |
| 55 | 57 |
| 56 def update(self, tree): | 58 def update(self, tree): |
