How would I use TypeVarTuple for this example?
T = TypeVar(“T”)
Ts = TypeVarTuple(“Ts”)
@dataclass
class S(Generic[T]):
data: T
def data_from_s(*structs: ??) -> ??:
return tuple(x.data for x in structs)
a = data_from_s(S(1), S(“3”)) # is type tuple[int, str]
from Using TypeVarTuple with inner TypeVar
No comments:
Post a Comment