In this example, power() gets the value of exponent from the outer function, generate_power(). Here’s what Python does when you call generate_power(): Define a new instance of power(), which takes a single arg
class Starship: stats: Dict[str, int] = {} Just as for function annotations, the Python interpreter does not attach any particular meaning to variable annotations and only stores them in the __annotations__ attribute of a class or module. In contrast to variable declarations in statically ty...