Skip to content

Commit

Permalink
Built-in generic now work without limitations
Browse files Browse the repository at this point in the history
Closes: python#1067
  • Loading branch information
srittau committed Feb 11, 2022
1 parent f6e8272 commit 3a789df
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions docs/source/stubs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,8 @@ Type checkers support cyclic imports in stub files.
Built-in Generics
-----------------

PEP 585 [#pep585]_ built-in generics are generally supported, with
the following exceptions [#ts-4820]_:

* Built-in generics don't work in type aliases.
* Built-in generics don't work in base classes.
* ``type`` is not supported.
* Variable length tuples (``tuple[X, ...]``) are not supported.

In these cases, the appropriate types from ``typing`` must be used.
PEP 585 [#pep585]_ built-in generics are supported and should be used instead
of the corresponding types from ``typing``.

Using imports from ``collections.abc`` instead of ``typing`` is
generally possible and recommended.
Expand Down Expand Up @@ -1101,7 +1094,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)
Expand Down

0 comments on commit 3a789df

Please sign in to comment.