In the code above, Orange
is a subclass of Fruit
. How do we use type hint to specify that fruit_type
in make_fruit
should be a subclass of Fruit
?
Using a parent class as a type hint will give you a type error when using mypy. Use typing.Type
instead.