Fredrik Lundh wrote:
Calvin Spealman wrote:e
>
>
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, not a full expression (as
Carl noted).
>
the summary at http://docs.python.org/ref/summary.html is broken; the
source code for that page looks like this:
>
...
\hline
\lineii{\code{+ }, \code{-}}{Addition and subtraction}
\hline
\lineii{\code{* }, \code{/}, \code{\%}}
{Multiplication , division, remainder}
\hline
\lineii{\code{+ \var{x}}, \code{-\var{x}}} {Positive, negative}
\lineii{\code{\ ~\var{x}}} {Bitwise not}
\hline
\lineii{\code{* *}} {Exponentiation }
\hline
\lineii{\code{\ var{x}.\var{att ribute}}} {Attribute reference}
\lineii{\code{\ var{x}[\var{index}]}} {Subscription}
\lineii{\code{\ var{x}[\var{index}:\va r{index}]}} {Slicing}
\lineii{\code{\ var{f}(\var{arg uments}...)}} {Function call}
\hline
...
>
which indicates that the author intended "." and "[" to appear in the
same box, but got overruled by the Tex->HTML conversion tool.
>
(if someone has the bandwidth, please submit a documentation bug).
>
>attribute access (foo.bar) binds more tightly than subscripting
>(foo[bar]).
>(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, not a full expression (as
Carl noted).
>
the summary at http://docs.python.org/ref/summary.html is broken; the
source code for that page looks like this:
>
...
\hline
\lineii{\code{+ }, \code{-}}{Addition and subtraction}
\hline
\lineii{\code{* }, \code{/}, \code{\%}}
{Multiplication , division, remainder}
\hline
\lineii{\code{+ \var{x}}, \code{-\var{x}}} {Positive, negative}
\lineii{\code{\ ~\var{x}}} {Bitwise not}
\hline
\lineii{\code{* *}} {Exponentiation }
\hline
\lineii{\code{\ var{x}.\var{att ribute}}} {Attribute reference}
\lineii{\code{\ var{x}[\var{index}]}} {Subscription}
\lineii{\code{\ var{x}[\var{index}:\va r{index}]}} {Slicing}
\lineii{\code{\ var{f}(\var{arg uments}...)}} {Function call}
\hline
...
>
which indicates that the author intended "." and "[" to appear in the
same box, but got overruled by the Tex->HTML conversion tool.
>
(if someone has the bandwidth, please submit a documentation bug).
I took the liberty of cutting and pasting your explanation, and added
""x.attribu te, x[index], x[index:index], f(arguments...) "
will not fit in the Operator column. I suggest adding
"[Next 4 have same precedence] Trailers"
with the next four lines indented 3 or 4 spaces in each column."
Feel free to add more if you think more is needed.
Terry Jan Reedy
Leave a comment: