Documentation
In the documentation for "Truth Value Testing" at https://docs.python.org/3/library/stdtypes.html#truth it says that the following are considered false:
- constants defined to be false:
None and False
- zero of any numeric type:
0, 0.0, 0j, Decimal(0), Fraction(0, 1)
- empty sequences and collections:
'', (), [], {}, set(), range(0)
This seems correct. No problems there.
However, in the documentation for "Boolean operations" at https://docs.python.org/3/reference/expressions.html#boolean-operations it says that the following are considered false:
False, None, numeric zero of all types, and empty strings and containers (including strings, tuples, lists, dictionaries, sets and frozensets).
This seems misleading to me. The wording is similar to the documentation for "Truth Value Testing", but note the difference between "zero of any numeric type" and "numeric zero of all types". The latter appears to suggest that '0' (a string containing the character zero) might be considered false, but of course it is considered true in Python.
I would suggest changing "numeric zero of all types" to "zero of any numeric type" (or "zero of all numeric types") to be consistent with the rest of the documentation (and to be consistent with the actual behavior of Python).
Linked PRs
Documentation
In the documentation for "Truth Value Testing" at https://docs.python.org/3/library/stdtypes.html#truth it says that the following are considered false:
This seems correct. No problems there.
However, in the documentation for "Boolean operations" at https://docs.python.org/3/reference/expressions.html#boolean-operations it says that the following are considered false:
This seems misleading to me. The wording is similar to the documentation for "Truth Value Testing", but note the difference between "zero of any numeric type" and "numeric zero of all types". The latter appears to suggest that
'0'(a string containing the character zero) might be considered false, but of course it is considered true in Python.I would suggest changing "numeric zero of all types" to "zero of any numeric type" (or "zero of all numeric types") to be consistent with the rest of the documentation (and to be consistent with the actual behavior of Python).
Linked PRs