(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/comparisons.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/types.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/truth.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/genindex.html| ]]
|
Next: 2.1.3 Comparisons Up: 2.1 Built-in Types Previous: 2.1.1 Truth Value Testing
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 1, else 0
|
(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 == b is interpreted as not (a == b), and a == not b is a syntax error.
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/comparisons.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/types.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/truth.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/genindex.html| ]]
|
Next: 2.1.3 Comparisons Up: 2.1 Built-in Types Previous: 2.1.1 Truth Value Testing
Send comments on this document to python-docs@python.org.