-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
The following code:
from typing import Tuple, Union
t: Union[Tuple[str, int], Tuple[int, str]] = ('A', 5)
print("%s %s" % t)produces the following output:
$ python3 Test.py
A 5
$ mypy Test.py
Test.py:4: error: Not enough arguments for format string
Found 1 error in 1 file (checked 1 source file)
$ mypy --version
mypy 0.740
$ python3 --version
Python 3.6.8Note that t is in any case a two-member tuple, but mypy still treats it as a single value, which is clearly wrong.
If only one Tuple[] is left inside the Union[] or Union[] is removed altogether, the problem disappears.