Operator precedence tableΒΆ
The following table summarizes the operator precedence of Python operators in this book, from highest precedence (most binding) to lowest precedence (least binding). Operators in the same box have the same precedence. Unless syntax is explicitly given, operators are binary. Operators in the same box group left to right (except for exponentiation, which groups from right to left). This is many of the entries from the complete Python table at https://docs.python.org/3/reference/expressions.html#operatorprecedence.
In the row for comparisons, membership tests, and identity tests, all have the same
precedence and have a lefttoright chaining feature; for example 3 < x <= y != z
.
Operator 
Description 


Binding or tuple display, list display, dictionary display, set display 

Subscription, slicing, call, attribute reference 

Exponentiation (groups right to left) 

Negation 

Multiplication, real and integer division, remainder 

Addition and subtraction 

Comparisons, including membership tests and identity tests 

Boolean NOT 

Boolean AND 

Boolean OR 