· Operators
· Operators, by precedence order:
| Operator | Description |
| lambda args: expr | Anonymous function constructor |
| x or y | Logical OR |
| x and y | Logical AND |
| not x | Logical NOT |
| x<y x<=y x>y x>=y x==y x!=y x<>y x is y x is not y x in s x not in s | Comparison operators (equal, not equal, is same object, belongs to a sequence...) |
| x|y | Bitwise OR |
| x^y | Exclusive OR |
| x&y | Bitwise AND |
| x<<y x>>y | Left shift, right shift |
| x+y x-y | Addition/concatenation, subtraction |
| x*y x/y x%y | Multiplication/repeat, division, modulo |
| x**y | Power |
| +x, -x, ~x | Identity, unary NOT, bitwise complement |
| s[i] s[i:j] s.attr f(...) | Index, range, attribute qualification, function call |
| (...) [...] {...} '...' | Tuple, list, dictionary, conversion to string |
No comments:
Post a Comment