Browse Source

Eval

pull/9/head
Jure Šorn 5 years ago
parent
commit
13ddb767a5
1 changed files with 3 additions and 3 deletions
  1. 6
      README.md

6
README.md

@ -1115,10 +1115,10 @@ def eval_node(node):
return node.n
if node_type not in [BinOp, UnaryOp]:
raise TypeError(node)
op_type = type(node.op)
if op_type not in legal_operators:
operator_type = type(node.op)
if operator_type not in legal_operators:
raise TypeError(f'Illegal operator {node.op}')
operator = legal_operators[op_type]
operator = legal_operators[operator_type]
if node_type == BinOp:
left, right = eval_node(node.left), eval_node(node.right)
return operator(left, right)

Loading…
Cancel
Save