[New-bugs-announce] [issue10769] ast: provide more useful range information

Sven Brauch report at bugs.python.org
Fri Dec 24 15:07:48 CET 2010


New submission from Sven Brauch <svenbrauch at googlemail.com>:

Hi,

I'm writing a python language support plugin for an IDE. I'm using the AST module to get information about the loaded source code, which works pretty well. However, in some cases, the information provided by the AST is simply not sufficient to do proper highlighting (or whatever); for example, 

class_instance.method(argument1.arg_attribute).attribute
class_instance.method(   argument1.    arg_attribute)    . attribute
and
class_instance.method(   argument1. \
                         arg_attribute)   \
                                   . attribute

produce exactly the same syntax tree, making it impossible to determine where e.g. "attribute" starts and ends. Although technically obviously correct, the information that the column offset for "attribute" is "0" is quite pointless.

It would really be great if there could be an additional attribute for Attribute Access nodes which tells me where the attribute access the node refers to *really* takes place, not just "column 0". :)
It would be even better if there was not only an offset, but also an "end" attribute providing information on where the node ends; that'd make this module way more useful, at least for me.

Thanks and best regards,
Sven

----------
components: Library (Lib)
messages: 124596
nosy: georg.brandl, scummos
priority: normal
severity: normal
status: open
title: ast: provide more useful range information
type: feature request

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


More information about the New-bugs-announce mailing list