diff options
author | Alex Waygood <Alex.Waygood@Gmail.com> | 2022-02-11 16:33:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 08:33:36 -0800 |
commit | 77e79377a51e8cbb489daa9a7dca2b425aa62451 (patch) | |
tree | 0e251b72e591999303c8cf0ebc50e666694b60ef | |
parent | 773f7595ab2f1d683a0ab211ca083cbc24a7af21 (diff) | |
download | typing-77e79377a51e8cbb489daa9a7dca2b425aa62451.tar.gz |
Update stubs.rst (#1069)
It's no longer necessary to use `# type: ignore`s for many uses of `ParamSpec` (hooray!)
-rw-r--r-- | docs/source/stubs.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/source/stubs.rst b/docs/source/stubs.rst index a7ab6df..161d679 100644 --- a/docs/source/stubs.rst +++ b/docs/source/stubs.rst @@ -315,14 +315,15 @@ But:: def create_it(cls: _T) -> _T: ... # cls has type _T PEP 612 [#pep612]_ parameter specification variables (``ParamSpec``) -are supported in argument and return types, although -they need to be marked with ``# type: ignore`` to work with all -type checkers [#ts-4827]_:: +are supported in argument and return types:: _P = ParamSpec("_P") - _T = TypeVar("_T") + _R = TypeVar("_R") + + def foo(cb: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... - def foo(cb: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore +However, ``Concatenate`` from PEP 612 is not yet supported; nor is using +a ``ParamSpec`` to parameterize a generic class. PEP 647 [#pep647]_ type guards are supported. @@ -1102,7 +1103,6 @@ Bugs .. [#ts-4819] typeshed issue #4819 -- PEP 604 tracker (https://github.com/python/typeshed/issues/4819) .. [#ts-4820] typeshed issue #4820 -- PEP 585 tracker (https://github.com/python/typeshed/issues/4820) -.. [#ts-4827] typeshed issue #4827 -- PEP 612 tracker (https://github.com/python/typeshed/issues/4827) .. [#ts-4913] typeshed issue #4913 -- PEP 613 tracker (https://github.com/python/typeshed/issues/4913) .. [#ts-4972] typeshed issue #4972 -- PEP 570 tracker (https://github.com/python/typeshed/issues/4972) |