I am learning a bit about annotations. I am using Python 3.8.6 and before I dig into the TypedDict
alternative, I would like to understand why my_dict()
is accepting a dictionary (movie
) that has an int
as value:
from typing import Dict
movie = {"name": "Torrente", "year": "1996"}
def my_dict(bla: Dict[str, int]):
return bla
print(my_dict(movie))
Could someone help me to understand this?