pycodestyle
pycodestyle copied to clipboard
E712: is based on a misreading of PEP8
Quoth the specification,
-
Don't compare boolean values to True or False using ==.
Yes: if greeting: No: if greeting == True: Worse: if greeting is True:
pycodestyle considers both the "yes" and the "worse" case equivalently good; if anything, it should complain more about the "Worse" case than the "Yes" one.
It also complains, I believe spuriously, about SQLAlchemy's overridden use of == as described in this Stack Overflow question.
Could this be restricted to just emitting the warning in the literal case of if ... == True:, or is True: which is probably redundant, and leaving more complex expressions alone?