Yurttas/PL/SL/python/docs/core-python-programming/doc/16/lib/boolean.html
Jump to navigation
Jump to search
2.1.2 Boolean Operations
These are the Boolean operations, ordered by ascending priority:
| Operation | Result | Notes | x or y
|
if x is false, then y, else x |
(1) |
|---|---|---|---|---|---|
x and y
|
if x is false, then x, else y |
(1) | |||
not x
|
if x is false, then |
(2) |
Notes:
- (1)
- These only evaluate their second argument if needed for their outcome.
- (2)
- "not" has a lower priority than non-Boolean operators, so
not a == bis interpreted asnot (a == b), anda == not bis a syntax error.