basedmypy
basedmypy copied to clipboard
`None` comparison overlap is wrong
a: int | None
b: str | None
a == b # Non-overlapping equality check (left operand type: "int | None", right operand type: "str | None") [comparison-overlap]
but it's still useful :trollface: :
Although this error message is flat out wrong, I do see the inadvertent value here: NoneType is a singleton inhabitant type, so it is more likely accidental, rather than intentionally checking that both values are None. If I wanted that I would write:
a is None and b is None
perhaps:
a == b # warning: the operands only overlap with "None", consider writing "a is None and b is None" [none-overlap]