Sample code:
def test() -> list[tuple[str, int]]:
some_dict = {"some": 3, "another": 5}
return some_dict.items()
For me it's quite obvious that it returns list of tuples: [("some", 3), ("another": 5)].
But dict.items() actually returns dict_items[("some", 3), ("another", 5)] and above result can be only achieved when casting it to list.
I wanted to have type annotation for this case, but list[tuple[str, int]] isn't working (checked with MyPy version 0.961) and I can't find anywhere how to annotate dict_items.
How to annotate function like this (without casting it to list, and preserving information about return type, not just Any)?