Summary
=======
The following table summarizes the operator precedences in Python,
from lowest precedence (least binding) to highest precedence (most
binding). Operators in the same box have the same precedence. Unless
the syntax is explicitly given, operators are binary. Operators in the
same box group left to right (except for comparisons, which chain from
left to right -- see above, and exponentiation, which groups from right
to left).
Operator Description
------ -----
`lambda' Lambda expression
`or' Boolean OR
`and' Boolean AND
`not' X Boolean NOT
`in', `not' `in' Membership tests
`is', `is not' Identity tests
`<', `<=', `>', `>=', `<>', `!=', Comparisons
`=='
`|' Bitwise OR
`^' Bitwise XOR
`&' Bitwise AND
`<'`<', `>'`>' Shifts
`+', `-' Addition and subtraction
`*', `/', `%' Multiplication, division, remainder
`+X', `-X' Positive, negative
`~X' Bitwise not
`**' Exponentiation
`X.ATTRIBUTE' Attribute reference
`X[INDEX]' Subscription
`X[INDEX:INDEX]' Slicing
`F(ARGUMENTS...)' Function call
`(EXPRESSIONS...)' Binding or tuple display
`[EXPRESSIONS...]' List display
`{KEY:DATUM...}' Dictionary display
``EXPRESSIONS...`' String conversion