comparison to False should be 'if cond is False:' or 'if not cond:

Question:

while line_number < dictionary_elements_number and validation_bool == False:

getting this error when i run it throught pep8 E712 comparison to False should be 'if cond is False:' or 'if not cond:'

isn’t that a bit weird?

Asked By: Clara

||

Answers:

From PEP8 documentation:

Comparisons to singletons like None should always be done with is or
is not, never the equality operators.

I guess False is also a singleton.

Answered By: Lucy Airapetian

while line_number < dictionary_elements_number and validation_bool is False:

Answered By: user20836921
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.