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

@ -11,16 +11,11 @@ ParenthesisRight = Symbols(')')
Number = Union[int, float, Fraction]
name_to_symbol = {sy.name:sy for sy in Symbols.instances}
name_to_symbol = Symbols.instances
def update_symbols_dict():
global name_to_symbol
name_to_symbol = {sy.name:sy for sy in Symbols.instances}
"""
example1 = "a + b * c + d"
-
@ -37,7 +32,7 @@ def preprocess(expr: str) -> List:
:param expr: string expression
:return: list of symbols and numbers
"""
update_symbols_dict()
return_list = []
expr = expr.strip()
expr = expr.replace(' ', '')