Python evaluates 0 as False

In Python, bool is a subclass of int, and False has the value 0; even if values weren’t implicitly cast to bool in an if statement (which they are), False == 0 is true.

Leave a Comment