I have something like
class Class1(Class2):
def __init__(
self,
use_class = Class3
...
):
do something
So Class1 inherits from Class2 and needs a parameter use_class which is set to Class3 by default. Class3 accepts floats and/or strings as input. But there can be other classes set to use instead of Class3. They also accept floats and/or strings as input. However, they all have to inherit from the same Class4. Furthermore, each of those classes that are valid inputs for use_class doesn't return anything. So my guess for typing would be
class Class1(Class2):
def __init__(
self,
use_class: Callable[[Union[float, str]], None] = Class3
...
):
do something
But this doesn't incorporate the fact that the class given as use_class has to inherit from Class4 in order for the code to run. Am I missing something here? I hope this question makes sense, any help or pointers are greatly appreciated.