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:
Clément Barthélemy 2024-02-20 01:33:03 +01:00
parent 77c8973eb7
commit 1738fa5d4c
6 changed files with 41 additions and 27 deletions

View file

@ -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})'