Given an ast
node that can be evaluated by itself, but is not literal enough for ast.literal_eval
e.g. a list comprehension
src = '[i**2 for i in range(10)]'
a = ast.parse(src)
Now a.body[0]
is an ast.Expr
and a.body[0].value
an ast.ListComp
. I would like to obtain the list that eval(src)
would result, but given only the ast.Expr
node.