Documentation
*Notes:
infer_variance parameter is implemented for typing.ParamSpec according to the source code as shown below:
...
if sys.version_info >= (3, 13):
def __new__(
cls,
name: str,
*,
bound: Any | None = None, # AnnotationForm
contravariant: bool = False,
covariant: bool = False,
infer_variance: bool = False, # <- Here
default: Any = ..., # AnnotationForm
) -> Self: ...
...
And, Python interpreter doesn't give error for ParamSpec with infer_variance parameter as shown below:
# ↓ ↓ No error ↓ ↓
P = ParamSpec('P', infer_variance=True)
So, the docs should also say infer_variance parameter with typing.ParamSpec explanation as shown below:
class typing.ParamSpec(name, *, bound=None, covariant=False, contravariant=False, infer_variance=False, default=typing.NoDefault)
Linked PRs
Documentation
*Notes:
infer_varianceparameter is implemented fortyping.ParamSpecaccording to the source code as shown below:... if sys.version_info >= (3, 13): def __new__( cls, name: str, *, bound: Any | None = None, # AnnotationForm contravariant: bool = False, covariant: bool = False, infer_variance: bool = False, # <- Here default: Any = ..., # AnnotationForm ) -> Self: ... ...And, Python interpreter doesn't give error for
ParamSpecwithinfer_varianceparameter as shown below:So, the docs should also say
infer_varianceparameter with typing.ParamSpec explanation as shown below:Linked PRs