On Aug 14, 7:17 pm, Michael Tobis <[EMAIL PROTECTED]> wrote:
> On Aug 14, 6:01 pm, "Calvin Spealman" <[EMAIL PROTECTED]> 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
> otherwise:
>
> http://docs.python.org/ref/summary.html


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
simplified explanation.


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.


Carl Banks

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to