[Python-Dev] Column offsets for attribute nodes

Sven Brauch svenbrauch at googlemail.com
Mon Dec 27 00:52:10 CET 2010

It should maybe be noted that the proposed patch would change that,
too, so it would be the same behaviour for all three types
(subscripts, calls, and attributes) again. Just more intuitive. :)

2010/12/27 Benjamin Peterson <benjamin at python.org>:
> 2010/12/26 Sven Brauch <svenbrauch at googlemail.com>:
>> Hi there,
>> I recently filed a feature request in the tracker to change the
>> behaviour of the parser in terms of setting ranges on attribute AST
>> nodes, because I'm working on an application which needs more
>> information than is currently provided. I suggested to change the
>> behaviour from
>> foo.bar.baz # <- foo is said to start at column 0, bar at 0 and baz at
>> 0 (current)
>> to
>> foo.bar.baz # <- foo starts at 0, bar at 3 and baz at 7 (suggestion)
>> In that discussion, there's been different opinions about which
>> behaviour is better; main arguments were "consistency" for the current
>> and "usefulness" for the suggested behaviour. It has been proposed to
>> ask the question on this list, that's why I'm doing that now. :)
> My argument against this change is that an attribute includes the
> expression from which the attribute is being taken. This is consistent
> with subscripts and calls, which both have the lineno and col_offset
> of their source expressions.
> --
> Regards,
> Benjamin

More information about the Python-Dev mailing list