Skip to content

Commit fc67ec2

Browse files
committed
Eval
1 parent 2d18c61 commit fc67ec2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ import ast
14051405
from ast import Num, BinOp, UnaryOp
14061406
import operator as op
14071407

1408-
legal_operators = {ast.Add: op.add,
1408+
LEGAL_OPERATORS = {ast.Add: op.add,
14091409
ast.Sub: op.sub,
14101410
ast.Mult: op.mul,
14111411
ast.Div: op.truediv,
@@ -1424,9 +1424,9 @@ def eval_node(node):
14241424
if node_type not in [BinOp, UnaryOp]:
14251425
raise TypeError(node)
14261426
operator_type = type(node.op)
1427-
if operator_type not in legal_operators:
1427+
if operator_type not in LEGAL_OPERATORS:
14281428
raise TypeError(f'Illegal operator {node.op}')
1429-
operator = legal_operators[operator_type]
1429+
operator = LEGAL_OPERATORS[operator_type]
14301430
if node_type == BinOp:
14311431
left, right = eval_node(node.left), eval_node(node.right)
14321432
return operator(left, right)

0 commit comments

Comments
 (0)