Hi Ran, Thanks for taking a look at the PEP and for taking the time to write up such a thoughtful response! I hadn't considered `ParametersOf` in the context of being able to do local captures as you describe, and the fact that TypeScript is able to support building something like this out of primitives is really cool.
However, I think that this alternative is actually less powerful than the proposal. The key issue is that sometimes we'd like to refer to the parameters of a function which has no name yet.
One case of this is when the parameter has a type that is more complex than a bare callable ``` def adaptable_decorator(f: Union[Callable[TParams, int], Callable[TParams, str]]) -> Callable[TParams, bool]: ... ```
Another case of this is classes parameterized on ParamSpecs. Consider a class that was constructed around a callable, which it forwards to through a `call` method. With ParamSpecs we can spell that like this: ``` class MyClass(Generic[TParams, TReturn]): f: Callable[TParams, TReturn]
def __init__(self, f: Callable[TParams, TReturn]) -> None: self.f = f
def call(__self, *args: TParams.args, **kwargs: TParams.kwargs) -> TReturn: f = __self.f # do some logging or something return f(*args, **kwargs) ```
In a `Parameters` operator world, the type of MyClass(some_function) would have to be somehow *more* than just MyClass, but in a way that is not a generic.
That all being said, I am personally strongly in favor of a follow-up PEP that would introduce `Parameters[global_function]`, since that is the only full-featured way to spell an instance of a class like MyClass, (e.g. `MyClass[ParametersOf[some_global_function_or_maybe_a_callback_protocol]]`)
Thanks again for the feedback!
Best, Mark Mendoza