from typing import Tuple, TypeVar, Any
ParamArray = TypeVar("ParamArray", Tuple[Any, ...])
The concept is; a ParamArray is just a tuple of values. I have a function
def integrate(func, a, b, args=()):
delta = 0.1
running_total = 0.
for x in range(a, b, step=delta):
running_total += func(x, args) * delta
return running_total
As such I was trying to type it:
def integrate(func:Callable[[float, ParamArray], float], a: float, b: float, args: ParamArray=()) -> float:
to try and convey the fact that the args ParamArray is the same thing that gets passed to func so the callback must be able to accept whatever args are passed.
I'm getting a few errors
TypeVar cannot have only a single constraint Argument 2 to "TypeVar" has incompatible type "object"; expected "Type[Any]" Variable "typealiases.ParamArray" is not valid as a type