I've got this:
def gradient_descent(
...
model_class: Type[Model],
J: Callable[[np.ndarray, model_class], float],
...
):
I want this function to take in a class, and also a function that accepts an instance of that class. However, this gives me the error Name "model_class" is not defined.
. I'm assuming that's because mypy doesn't have access to model_class
at typechecking time.
Is there any way to achieve this?