The optional comparetozero extension to pylint checks for any comparison to 0 and flags it. It is unclear to me why this is bad to do.
According to the docstring of the comparetozero module,
Most of the times you should use the fact that integers with a value of 0 are false.
An exception to this rule is when 0 is allowed in the program and has a different meaning than None!
What exactly does this mean?
My understanding of the above is that it means that you should not do something like
def return_false():
return False
if return_false() == 0:
pass
because that is abusing the falsy nature of 0, but that it is okay to do
if foo % 4 == 0:
pass
because you are comparing two integers to see if they are both literally zero.
If my understanding is correct, is it better to make specific # pylint: disable statements for the instances where you are literally checking if a value is zero, or what?