Fix various ParamSpec errors in typing#24176
Conversation
| see :pep:`484`. | ||
|
|
||
| .. class:: ParamSpec(name, *, bound=None, covariant=False, contravariant=False) | ||
| .. class:: ParamSpec(name, bound=None, covariant=False, contravariant=False) |
There was a problem hiding this comment.
Hm. I would rather add the star to the code.
There was a problem hiding this comment.
Hmm after giving it some thought, I agree. I realized ParamSpec and TypeVar have different init signatures, (TypeVar has *constraints and ParamSpec doesn't). And PEP 612 states that
However, enforcing these constraints would require enough additional implementation work that we judged this extension to be out of scope of this PEP. Fortunately the design of ParamSpecs are such that we can return to this idea later if there is sufficient demand.
so to prevent any backwards incompatibility in the future, we should enforce it, so that if we do add constraints in the future, existing code won't break.
Edit: bounds -> constraints
1. ParamSpec -> TypeVar for ``typing.Concatenate`` 2. ParamSpec's call signature should align with its documentation. Noticed in pythonGH-24169
typing.ConcatenateNoticed in Fix a typo #24169
Automerge-Triggered-By: GH:gvanrossum