与 False 的比较应该是 'if cond is False:' 或 'if not cond:

Cla*_*ara 0 python pep8 python-3.x

while line_number < dictionary_elements_number and validation_bool == False:
Run Code Online (Sandbox Code Playgroud)

当我通过 pep8 运行它时出现此错误E712 comparison to False should be 'if cond is False:' or 'if not cond:' 是不是有点奇怪?

小智 5

来自PEP8文档:

与像 None 这样的单例的比较应该总是用 is 或 is not 来完成,永远不要使用相等运算符。

我猜 False 也是一个singleton