Radek Novacek added the comment:
I've ran the tests from first and second comment using python 3.5.0 and it
seems it produces correct results:
>>> import ast
>>> tree = ast.parse("sin(0.5)")
>>> first_stmt = tree.body[0]
>>> call = first_
Radek Novacek added the comment:
There is still problem with col_offset is some situations, for example
col_offset of the ast.Attribute should be 4 but is 0 instead:
>>> for x in ast.walk(ast.parse('foo.bar')):
... if hasattr(x, 'col_offset'):
... prin
Radek Novacek added the comment:
Aivar, I have to admit that my knowledge of this is limited, but as I
understand it, the attribute is "bar" in the "foo.bar" expression.
I can get beginning of the assignment by
>>> ast.parse('foo.bar').body[0].valu