As it was discussed in #8069, sometimes we need to logically separate int and bool types.
Currently mypy allows this to happen:
def some(a: int): ...
some(x > 1)
Because bool is subtype of int. I am proposing to add a strict-bool mode, so bool would be treated as a non-int type. And this code would generate an error.
It can be a new config option: --strict-bool or a new disabled by default error code in the future as @JukkaL suggested.
As it was discussed in #8069, sometimes we need to logically separate
intandbooltypes.Currently
mypyallows this to happen:Because
boolis subtype ofint. I am proposing to add astrict-boolmode, soboolwould be treated as a non-int type. And this code would generate an error.It can be a new config option:
--strict-boolor a new disabled by default error code in the future as @JukkaL suggested.