-
Notifications
You must be signed in to change notification settings - Fork 274
Closed
Labels
resolution: duplicateThe idea/problem was already reportedThe idea/problem was already reported
Description
I just started trying to apply typing to a code base, so I may be greatly miss-understanding what I am doing, but here we go :)
We have a case where we get a tuple back from a user supplied function which must be (None, None), (some_not_none, None), or (some_not_none, other_not_none), that the second value can only be not None if the first value is also not None. (This is why I did not do Tuple[Optional[int], Optional[int]]).
A minimal example to reproduce the issues is
from typing import Tuple, Union
InputType = Union[Tuple[None, None],
Tuple[int, None],
Tuple[int, int]]
def f(a: InputType) -> None:
b, c = a
which gives
(dd36) ✔ ~
17:32 $ mypy --version
mypy 0.471
(dd36) ✔ ~
17:32 $ mypy /tmp/test.py
/tmp/test.py:9: error: 'Union[Tuple[void, void], Tuple[builtins.int, void], Tuple[builtins.int, builtins.int]]' object is not iterable
Metadata
Metadata
Assignees
Labels
resolution: duplicateThe idea/problem was already reportedThe idea/problem was already reported