Closed
Description
Is there an api to annotate the AST, I'm interested in knowing the type of all subexpressions.
For example in the code:
min(3, 4)
'foo' * 2
def f(a: int, min: Callable[[int, int], int]) -> int:
return min(a, 314)
I would like to know that
min -> __builtin__.min
3 -> int
4 -> int
min(3, 4) -> int
'foo' -> str
2 -> int
'foo' * 2 -> str
# In function f
a -> int
314 int
min -> Callable[[int, int], int] not __builtin__.min
min(a, 314) -> int
and ideally the expression should have line number and offset information to match it with the AST nodes.