Change "instances" class variables of Smybols and children of Symbols to Dict instead of List. Start expand.py (not completed)
This commit is contained in:
parent
77c8973eb7
commit
1738fa5d4c
6 changed files with 41 additions and 27 deletions
|
@ -24,6 +24,10 @@ class Tree(ABC):
|
|||
self.depth_first_order = depth_first_order
|
||||
self.children = children if children else []
|
||||
|
||||
@property
|
||||
def is_leaf(self) -> bool:
|
||||
return not self.children
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f'Tree({self.value}, {self.children})' if self.children else f'Tree({self.value})'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue