Search code examples
pythonpython-3.xpep8

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


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?


Solution

  • 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.