2
0
mirror of https://github.com/m-labs/artiq.git synced 2025-02-13 11:03:20 +08:00
artiq/artiq/compiler/tools.py
2014-06-16 21:35:08 +02:00

8 lines
187 B
Python

import ast
def eval_ast(expr, symdict=dict()):
if not isinstance(expr, ast.Expression):
expr = ast.Expression(expr)
code = compile(expr, "<ast>", "eval")
return eval(code, symdict)