basedmypy icon indicating copy to clipboard operation
basedmypy copied to clipboard

Warn when a falsey boolean context is ambigious with `None`

Open KotlinIsland opened this issue 2 years ago • 0 comments

a: bool | None
if not a:  # error: the type of 'a' contains "None" and could be a mistake to check it in a boolean context
    ...

Not just bools, but anything that could be false.

KotlinIsland avatar Oct 31 '23 01:10 KotlinIsland