Pre-PEP Considerations and Feedback: Type Transformations on Variadic Generics

Personally, I dislike both *Iterable[Ts] and Map[Iterable, Ts].

Let’s say I have a function that takes in n instances of ints and returns n instances of strs. To make the mapping work, I would have to specify an useless-looking type alias (assuming binding TypeVarTuple is already possible):

type Str[_T] = str

def stringify_all[*Ts: int](*args: *Ts) -> tuple[*Str[Ts]]:
    return tuple(str(arg) for arg in args)

def stringify_all[*Ts: int](*args: *Ts) -> tuple[Map[Str, Ts]]:
    return tuple(str(arg) for arg in args)

A “type lambda”-like syntax would look much better and more similar to the global map():

def stringify_all[*Ts: int](*args: *Ts) -> tuple[Map[(T) -> str, Ts]]:
    return tuple(str(arg) for arg in args)

I understand that adding new syntax to the language is a heavy burden for implementers, so this probably wouldn’t make it if it were to be proposed, especially if a successor of PEP 677 is accepted first. Taking this into account, maybe the type alias way isn’t so bad after all.