For some reason, PEP 612 forbids keyword-only parameters from being used with parameter specifications.
from typing import Generic
from typing_extensions import ParamSpec
P = ParamSpec('P')
class C(Generic[P]):
def f(self, x: int, *args: P.args, y: int | None = None, **kwargs: P.kwargs) -> int:
return x + (0 if y is None else y)
Is there any motivation for this limitation?