-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
Code:
from typing import *
Pair = Tuple[Any, Any]
def f(a: Union[Any, Pair]):
x, y = a # E: 'Union[Any, Tuple[Any, Any]]' object is not iterableIf the type of argument is either just Any or just Pair the code passes. But with the union it gives the error.
UPDATE: I don't think the unreduced union is at fault -- an example with two different Tuple types of length 2 also fails. It's more that the unpack operation isn't tried for each variant of the union.
Reactions are currently unavailable