Ivan Levkivskyi added the comment:
As Serhiy explained, there is no bug here, _potentially_ we could change AST so
that attribute name (i.e. "b" in "a.b") is wrapped in a special node holding
the position info (similar to ``ast.arg``), but it is a breaking change and is
not worth it. You
Serhiy Storchaka added the comment:
AST for expression a.b.c is
Attribute(
value=Attribute(
value=Name(
id='a',
ctx=Load(),
lineno=1,
col_offset=0,
end_lineno=1,
Andrew Briand added the comment:
It looks like the test suite (in particular test_ast) specifically checks for
the behavior where the col_offset of c in a.b.c.d is 0. This seems strange to
me though, does anyone know if this is intended? If not, I can patch it.
--
nosy:
New submission from Justin McCann :
This issue is related to https://github.com/microsoft/vscode-python/issues/7327
and https://github.com/PyCQA/pylint/issues/3103
For compound attribute access in variable references like a.b.c.d, the AST
reports the column of the first variable/attribute in