allow to user "+" and other operation in Expression initialisation
This commit is contained in:
parent
82e051423c
commit
fc4d8d19f3
@ -89,7 +89,8 @@ class Expression(Explicable):
|
|||||||
if type(exp) == str:
|
if type(exp) == str:
|
||||||
expression.postfix_tokens = str2tokens(exp)
|
expression.postfix_tokens = str2tokens(exp)
|
||||||
elif type(exp) == list:
|
elif type(exp) == list:
|
||||||
expression.postfix_tokens = flatten_list([tok.postfix_tokens if Expression.isExpression(tok) else tok for tok in exp])
|
exp_mod_op = [op.get_op(i) if (str(i) in "+-*/^" and not isOperator(i)) else i for i in exp]
|
||||||
|
expression.postfix_tokens = flatten_list([tok.postfix_tokens if Expression.isExpression(tok) else tok for tok in exp_mod_op])
|
||||||
elif type(exp) == Expression:
|
elif type(exp) == Expression:
|
||||||
return exp
|
return exp
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user