How to type hint a dictionary with values of different types
When declaring a dictionary as a literal, is there a way to type-hint what value I am expecting for a specific key? And then, for discussion: are there guiding principles around dictionary typing in Python? I'm wondering whether it is considered bad practice to mix types in dictionaries. Here's an example: Consider the declaration of a dictionary in a class's __init__ : (disclaimer: I realize in the example, some of the .elements entries would probably be more appropriate as class attributes, but it's for the sake of the example). class Rectangle: def __init__(self, corners: Tuple[Tuple[float,