Skip to content

Commit 77e7937

Browse files
authored
Update stubs.rst (#1069)
It's no longer necessary to use `# type: ignore`s for many uses of `ParamSpec` (hooray!)
1 parent 773f759 commit 77e7937

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/source/stubs.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,15 @@ But::
315315
def create_it(cls: _T) -> _T: ... # cls has type _T
316316

317317
PEP 612 [#pep612]_ parameter specification variables (``ParamSpec``)
318-
are supported in argument and return types, although
319-
they need to be marked with ``# type: ignore`` to work with all
320-
type checkers [#ts-4827]_::
318+
are supported in argument and return types::
321319

322320
_P = ParamSpec("_P")
323-
_T = TypeVar("_T")
321+
_R = TypeVar("_R")
322+
323+
def foo(cb: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
324324

325-
def foo(cb: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore
325+
However, ``Concatenate`` from PEP 612 is not yet supported; nor is using
326+
a ``ParamSpec`` to parameterize a generic class.
326327

327328
PEP 647 [#pep647]_ type guards are supported.
328329

@@ -1102,7 +1103,6 @@ Bugs
11021103

11031104
.. [#ts-4819] typeshed issue #4819 -- PEP 604 tracker (https://github.com/python/typeshed/issues/4819)
11041105
.. [#ts-4820] typeshed issue #4820 -- PEP 585 tracker (https://github.com/python/typeshed/issues/4820)
1105-
.. [#ts-4827] typeshed issue #4827 -- PEP 612 tracker (https://github.com/python/typeshed/issues/4827)
11061106
.. [#ts-4913] typeshed issue #4913 -- PEP 613 tracker (https://github.com/python/typeshed/issues/4913)
11071107
.. [#ts-4972] typeshed issue #4972 -- PEP 570 tracker (https://github.com/python/typeshed/issues/4972)
11081108

0 commit comments

Comments
 (0)