true-false-comparison (E712)
Added in v0.0.28 · Related issues · View source
Derived from the pycodestyle linter.
Fix is always available.
What it does
Checks for equality comparisons to boolean literals.
Why is this bad?
PEP 8 recommends against using the equality operators == and != to
compare values to True or False.
Instead, use if cond: or if not cond: to check for truth values.
If you intend to check if a value is the boolean literal True or False,
consider using is or is not to check for identity instead.
Example
Use instead:
Fix safety
This rule's fix is marked as unsafe, as it may alter runtime behavior when
used with libraries that override the ==/__eq__ or !=/__ne__ operators.
In these cases, is/is not may not be equivalent to ==/!=. For more
information, see this issue.