Is is possible to create a generic type that access a variable length argument types?
Basically, I'm trying to create a generic observable where the user can define which arguments they want to accept with type hints.
Ex:
Types = TypeVar("Types", var_length=True)
class Obserable(Generic[Types]):
def subscribe(func: Callable[[Types], None]):
...
def notify(*args: Types):
...
def callback(arg1: int, arg2: str, arg3: int) -> None:
...
observer: Observable[int, str, int] = Observable()
observer.subscribe(callback)
observer.notify(1, "hello", 5)