Re: precedence of [] vs .

2008-08-15 Thread Terry Reedy
Fredrik Lundh wrote: Calvin Spealman wrote:e attribute access (foo.bar) binds more tightly than subscripting (foo[bar]). no, they have the same binding power; here's the relevant part of the grammar: trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME note however that "."

Re: precedence of [] vs .

2008-08-15 Thread Fredrik Lundh
Carl Banks wrote: 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 rendered summary is broken; see my other post. -- http://mail.python.org/ma

Re: precedence of [] vs .

2008-08-15 Thread Fredrik Lundh
Calvin Spealman wrote:e attribute access (foo.bar) binds more tightly than subscripting (foo[bar]). no, they have the same binding power; here's the relevant part of the grammar: trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME note however that "." only binds to a name, n

Re: precedence of [] vs .

2008-08-14 Thread Carl Banks
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.

Re: precedence of [] vs .

2008-08-14 Thread Terry Reedy
Michael Tobis 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 o

Re: precedence of [] vs .

2008-08-14 Thread Michael Tobis
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.

Re: precedence of [] vs .

2008-08-14 Thread Calvin Spealman
On Thu, Aug 14, 2008 at 6:46 PM, Michael Tobis <[EMAIL PROTECTED]> wrote: > I wrote some code to test the precedence of getitem vs getattr; it > shows that getitem binds tighter. > > I have been handed some code that relies on the observed behavior. > However, the Nutshell precedence list claims th

precedence of [] vs .

2008-08-14 Thread Michael Tobis
I wrote some code to test the precedence of getitem vs getattr; it shows that getitem binds tighter. I have been handed some code that relies on the observed behavior. However, the Nutshell precedence list claims the opposite. Is the Nutshell wrong or am I missing something or is this a bug? clas