When you execute this code:
from typing import Dict
bar: Dict[int, int, int] = dict()
an exception TypeError with a message Too many parameters for typing.Dict; actual 3, expected 2 is raised. But when you define the variable inside a function:
from typing import Dict
def foo():
bar: Dict[int, int, int] = dict()
foo()
no exception is raised this time. Is this an expected behavior or a bug?