PEP 692: Using TypedDict for more precise **kwargs typing

Is it too crazy to suggest that ParamSpec be used for this purpose? We already have ParamSpec.kwargs as a way of referring to a bound type’s kwargs.

The trouble as I see it is that a ParamSpec can’t today be assigned a specific callable which it describes.

Disclaimer: I got here by way of an ideas post I just put up ( Dynamically building ParamSpecs from callables ) and missed the whole mypy thread and past work. I don’t want to disrespect the significant amount of work already done on this topic, but the mypy issue predates PEP 612, so it seems like there might be a missed opportunity to unify the ideas.

2 Likes