Say I have a function, do_something:
from typing import Sequence, Tuple, Dict
def do_something(argument: Sequence[Tuple[int, str]]):
pass
Say I also have a dictionary, D, the keys of which are solely ints, and the values of which are solely strs:
D: Dict[int, str] = {1: 'a', 2: 'b', 3: 'c'}
In PyCharm, this will pass the type-checker with flying colours:
do_something(
((1, 'a'), (2, 'b'), (3, 'c'))
)
But this, according to PyCharm, fails the type-checker, despite being identical in what it produces:
do_something(tuple(D.items()))
Is this expected behaviour -- am I missing something here? -- or is this a bug with PyCharm's type-checker?