precedence of [] vs .

Terry Reedy tjreedy at udel.edu
Fri Aug 15 00:48:23 EDT 2008



Michael Tobis 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
> otherwise:
> 
> http://docs.python.org/ref/summary.html

For 3.0, the error message for Barney.Albert)['abcd'] is slightly 
different -- TypeError: string indices must be integers -- but the 
effect is the same.  I submitted
http://bugs.python.org/issue3558

tjr




More information about the Python-list mailing list