MyPy seems to be unaware of the length of a Tuple when wrapped in a Union:
from typing import Union, Tuple
def get_tuple() -> Union[Tuple[int, int], Tuple[None, None]]:
return (1, 2)
def process_tuple(one, two, flag=False):
print(one, two, flag)
process_tuple(*get_tuple(), flag=True)
1.py:12: error: "process_tuple" gets multiple values for keyword argument "flag"
Same code without a unionized type (def get_tuple() -> Tuple[int, int]:) works.
MyPy seems to be unaware of the length of a
Tuplewhen wrapped in aUnion:Same code without a unionized type (
def get_tuple() -> Tuple[int, int]:) works.