Serhiy Storchaka <[email protected]> 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,
end_col_offset=1),
attr='b',
ctx=Load(),
lineno=1,
col_offset=0,
end_lineno=1,
end_col_offset=3),
attr='c',
ctx=Load(),
lineno=1,
col_offset=0,
end_lineno=1,
end_col_offset=5)
It contains one Name node for "a" and two Attribute nodes for "a.b" and
"a.b.c". Every node has attributes lineno, col_offset, end_lineno and
end_col_offset. Note that there are no nodes for "b" and "c", therefore there
is no information about the location of "c" in AST.
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38166>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com