Why does PyCharm incorrectly guess type for a list of dict_items?

Viewed 103

For this piece of code:

from typing import Dict, List, Tuple, Any


def test(d: Dict[int, Any]):
    item_list: List[Tuple[int, Any]] = list(d.items())

PyCharm guesses that item_list will be of type List[int] for some reason:

PyCharm screenshot

Am I missing something or this is quite an easy case of deducing the type and PyCharm is in the wrong here?

1 Answers
Related