Open Doomsk opened 2 years ago
I wrote a helper method to walk through the AST and print out the summary in a tree-like format like below:
Module(
body=[Assign(
targets=[Name(
id='a'
ctx=Store()
lineno=1
col_offset=1
)]
value=Num(
n=2
lineno=1
col_offset=3
)
lineno=1
col_offset=1
)Expr(
value=Call(
func=Name(
id='print'
ctx=Load()
lineno=2
col_offset=1
)
args=[Name(
id='a'
ctx=Load()
lineno=2
col_offset=7
)]
keywords=[]
lineno=2
col_offset=1
)
lineno=2
col_offset=1
)]
)
Does anyone know how to get the AST instead of evaluating it directly so one can debug it?