precedence of  vs .
pavlovevidence at gmail.com
Fri Aug 15 07:08:42 CEST 2008
On Aug 14, 7:17 pm, Michael Tobis <mto... at gmail.com> wrote:
> On Aug 14, 6:01 pm, "Calvin Spealman" <ironfro... at gmail.com> wrote:
> > attribute access (foo.bar) binds more tightly than subscripting (foo[bar]).
> That certainly looks right, and in retrospect I wonder that I even
> doubted it. But even the official docs seem to me to specify
I think the summary is correct (am not going to bother to double-
check), but there's a subtle point you're missing. Here is a
The syntax for subscript operator is:
expression [ expression ]
The syntax for attribute access is:
expression . symbol
The subtle point here is that the symbol that comes after the dot is
NOT an expression, and therefore can't serve as the first expression
in the subscript opreator rules.
The effect of this is that the grouping a.(b[c]) is impossible.
More information about the Python-list