[issue10769] ast: provide more useful range information

Benjamin Peterson report at bugs.python.org
Sat Dec 25 16:19:17 CET 2010


Benjamin Peterson <benjamin at python.org> added the comment:

2010/12/25 Sven Brauch <report at bugs.python.org>:
>
> Sven Brauch <svenbrauch at googlemail.com> added the comment:
>
> Well, weather it's supposed to or not, it *does* contain the line number information:
> <ExprAst lineno="1" col_offset="0">
> For your example, the AST for "foo" tells you the offset for foo. If you want to know the offset (well, "offset") for blah, why not look at foo? Currently, the information is just copied from foo to blah.

What if it's like this, though?

x = (    foo).blah

>
> Anyway, I'd like to get away from this abstract discussion which is not likely to yield a result... is there any reason not to do it like I suggested other than the philosophical "it's wrong"? Or don't you agree that the information given this way would be more useful?

It wouldn't be any more useful than it is now. I don't think it's
reasonably possible to preserve every last obscure formatting in ast.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10769>
_______________________________________


More information about the Python-bugs-list mailing list