-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
featurepriority-2-lowtopic-strict-optionaltopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder
Description
A user reported code which basically boils down to this:
class A:
a: Optional[int]
b: Optional[int]
...
def f(self) -> None:
if None in (self.a, self.b):
return
print(self.a + self.b) # ok at runtime but mypy error currently
Mypy doesn't recognize the None in (...)
test as a legitimate None test.
The code seems a little unusual but if we see this frequently enough it might be worth supporting at some point.
Metadata
Metadata
Assignees
Labels
featurepriority-2-lowtopic-strict-optionaltopic-type-narrowingConditional type narrowing / binderConditional type narrowing / binder