I remember being appalled by this the first time I saw this. But I've gotten used to it. It also means that rather than writing: `if some_boolean: count += 1`, you can instead write `count += some_boolean`. Your opinion of this may vary.
– Frank YellinOct 23 '20 at 06:45
It's also possible to do things such as `some_var=['some_action','some_other_action'][function_that_returns_a_bool()]`, which is more readable, omce you're used to it, than the equivalent if/else boilerplate.
– SiHaOct 23 '20 at 06:51
1 Answers1
0
Since bool is a subclass of int that's why True acts like 1 and False like 0