mirror of
https://github.com/python/cpython.git
synced 2026-02-11 12:21:37 +00:00
gh-98507: [typing docs] Rephrase "now supports []" to "now supports subscripting" (GH-98508)
(cherry picked from commit e3b9dd8e87)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
39e914c03a
commit
d79a42aac8
1 changed files with 78 additions and 72 deletions
|
|
@ -631,8 +631,8 @@ These can be used as types in annotations using ``[]``, each having a unique syn
|
|||
is equivalent to ``Tuple[Any, ...]``, and in turn to :class:`tuple`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`builtins.tuple <tuple>` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`builtins.tuple <tuple>` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. data:: Union
|
||||
|
||||
|
|
@ -720,8 +720,8 @@ These can be used as types in annotations using ``[]``, each having a unique syn
|
|||
respectively.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Callable` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`collections.abc.Callable` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. versionchanged:: 3.10
|
||||
``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`.
|
||||
|
|
@ -827,8 +827,8 @@ These can be used as types in annotations using ``[]``, each having a unique syn
|
|||
.. versionadded:: 3.5.2
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`builtins.type <type>` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`builtins.type <type>` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. data:: Literal
|
||||
|
||||
|
|
@ -1597,8 +1597,8 @@ Corresponding to built-in types
|
|||
...
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`builtins.dict <dict>` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`builtins.dict <dict>` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: List(list, MutableSequence[T])
|
||||
|
||||
|
|
@ -1618,8 +1618,8 @@ Corresponding to built-in types
|
|||
return [item for item in vector if item > 0]
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`builtins.list <list>` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`builtins.list <list>` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Set(set, MutableSet[T])
|
||||
|
||||
|
|
@ -1628,16 +1628,17 @@ Corresponding to built-in types
|
|||
to use an abstract collection type such as :class:`AbstractSet`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`builtins.set <set>` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`builtins.set <set>` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: FrozenSet(frozenset, AbstractSet[T_co])
|
||||
|
||||
A generic version of :class:`builtins.frozenset <frozenset>`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`builtins.frozenset <frozenset>` now supports ``[]``. See
|
||||
:pep:`585` and :ref:`types-genericalias`.
|
||||
:class:`builtins.frozenset <frozenset>`
|
||||
now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. note:: :data:`Tuple` is a special form.
|
||||
|
||||
|
|
@ -1651,8 +1652,8 @@ Corresponding to types in :mod:`collections`
|
|||
.. versionadded:: 3.5.2
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.defaultdict` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`collections.defaultdict` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: OrderedDict(collections.OrderedDict, MutableMapping[KT, VT])
|
||||
|
||||
|
|
@ -1661,8 +1662,8 @@ Corresponding to types in :mod:`collections`
|
|||
.. versionadded:: 3.7.2
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.OrderedDict` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`collections.OrderedDict` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: ChainMap(collections.ChainMap, MutableMapping[KT, VT])
|
||||
|
||||
|
|
@ -1672,8 +1673,8 @@ Corresponding to types in :mod:`collections`
|
|||
.. versionadded:: 3.6.1
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.ChainMap` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`collections.ChainMap` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Counter(collections.Counter, Dict[T, int])
|
||||
|
||||
|
|
@ -1683,8 +1684,8 @@ Corresponding to types in :mod:`collections`
|
|||
.. versionadded:: 3.6.1
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.Counter` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`collections.Counter` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Deque(deque, MutableSequence[T])
|
||||
|
||||
|
|
@ -1694,8 +1695,8 @@ Corresponding to types in :mod:`collections`
|
|||
.. versionadded:: 3.6.1
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.deque` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`collections.deque` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
Other concrete types
|
||||
""""""""""""""""""""
|
||||
|
|
@ -1756,8 +1757,8 @@ Corresponding to collections in :mod:`collections.abc`
|
|||
A generic version of :class:`collections.abc.Set`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Set` now supports ``[]``. See :pep:`585` and
|
||||
:ref:`types-genericalias`.
|
||||
:class:`collections.abc.Set` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: ByteString(Sequence[int])
|
||||
|
||||
|
|
@ -1770,8 +1771,8 @@ Corresponding to collections in :mod:`collections.abc`
|
|||
annotate arguments of any of the types mentioned above.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.ByteString` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.ByteString` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Collection(Sized, Iterable[T_co], Container[T_co])
|
||||
|
||||
|
|
@ -1780,32 +1781,32 @@ Corresponding to collections in :mod:`collections.abc`
|
|||
.. versionadded:: 3.6.0
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Collection` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Collection` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Container(Generic[T_co])
|
||||
|
||||
A generic version of :class:`collections.abc.Container`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Container` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Container` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: ItemsView(MappingView, AbstractSet[tuple[KT_co, VT_co]])
|
||||
|
||||
A generic version of :class:`collections.abc.ItemsView`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.ItemsView` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.ItemsView` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: KeysView(MappingView, AbstractSet[KT_co])
|
||||
|
||||
A generic version of :class:`collections.abc.KeysView`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.KeysView` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.KeysView` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Mapping(Sized, Collection[KT], Generic[VT_co])
|
||||
|
||||
|
|
@ -1816,56 +1817,58 @@ Corresponding to collections in :mod:`collections.abc`
|
|||
return word_list[word]
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Mapping` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Mapping` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: MappingView(Sized)
|
||||
|
||||
A generic version of :class:`collections.abc.MappingView`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.MappingView` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.MappingView` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: MutableMapping(Mapping[KT, VT])
|
||||
|
||||
A generic version of :class:`collections.abc.MutableMapping`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.MutableMapping` now supports ``[]``. See
|
||||
:pep:`585` and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.MutableMapping`
|
||||
now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: MutableSequence(Sequence[T])
|
||||
|
||||
A generic version of :class:`collections.abc.MutableSequence`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.MutableSequence` now supports ``[]``. See
|
||||
:pep:`585` and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.MutableSequence`
|
||||
now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: MutableSet(AbstractSet[T])
|
||||
|
||||
A generic version of :class:`collections.abc.MutableSet`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.MutableSet` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.MutableSet` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Sequence(Reversible[T_co], Collection[T_co])
|
||||
|
||||
A generic version of :class:`collections.abc.Sequence`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Sequence` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Sequence` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: ValuesView(MappingView, Collection[_VT_co])
|
||||
|
||||
A generic version of :class:`collections.abc.ValuesView`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.ValuesView` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.ValuesView` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
Corresponding to other types in :mod:`collections.abc`
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
|
|
@ -1875,16 +1878,16 @@ Corresponding to other types in :mod:`collections.abc`
|
|||
A generic version of :class:`collections.abc.Iterable`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Iterable` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Iterable` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Iterator(Iterable[T_co])
|
||||
|
||||
A generic version of :class:`collections.abc.Iterator`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Iterator` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Iterator` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Generator(Iterator[T_co], Generic[T_co, T_contra, V_co])
|
||||
|
||||
|
|
@ -1918,8 +1921,8 @@ Corresponding to other types in :mod:`collections.abc`
|
|||
start += 1
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Generator` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Generator` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Hashable
|
||||
|
||||
|
|
@ -1930,8 +1933,8 @@ Corresponding to other types in :mod:`collections.abc`
|
|||
A generic version of :class:`collections.abc.Reversible`.
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Reversible` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Reversible` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Sized
|
||||
|
||||
|
|
@ -1955,8 +1958,8 @@ Asynchronous programming
|
|||
.. versionadded:: 3.5.3
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Coroutine` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Coroutine` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra])
|
||||
|
||||
|
|
@ -1992,8 +1995,9 @@ Asynchronous programming
|
|||
.. versionadded:: 3.6.1
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.AsyncGenerator` now supports ``[]``. See
|
||||
:pep:`585` and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.AsyncGenerator`
|
||||
now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: AsyncIterable(Generic[T_co])
|
||||
|
||||
|
|
@ -2002,8 +2006,8 @@ Asynchronous programming
|
|||
.. versionadded:: 3.5.2
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.AsyncIterable` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.AsyncIterable` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: AsyncIterator(AsyncIterable[T_co])
|
||||
|
||||
|
|
@ -2012,8 +2016,8 @@ Asynchronous programming
|
|||
.. versionadded:: 3.5.2
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.AsyncIterator` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.AsyncIterator` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: Awaitable(Generic[T_co])
|
||||
|
||||
|
|
@ -2022,8 +2026,8 @@ Asynchronous programming
|
|||
.. versionadded:: 3.5.2
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`collections.abc.Awaitable` now supports ``[]``. See :pep:`585`
|
||||
and :ref:`types-genericalias`.
|
||||
:class:`collections.abc.Awaitable` now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
|
||||
Context manager types
|
||||
|
|
@ -2037,8 +2041,9 @@ Context manager types
|
|||
.. versionadded:: 3.6.0
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`contextlib.AbstractContextManager` now supports ``[]``. See
|
||||
:pep:`585` and :ref:`types-genericalias`.
|
||||
:class:`contextlib.AbstractContextManager`
|
||||
now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
.. class:: AsyncContextManager(Generic[T_co])
|
||||
|
||||
|
|
@ -2048,8 +2053,9 @@ Context manager types
|
|||
.. versionadded:: 3.6.2
|
||||
|
||||
.. deprecated:: 3.9
|
||||
:class:`contextlib.AbstractAsyncContextManager` now supports ``[]``. See
|
||||
:pep:`585` and :ref:`types-genericalias`.
|
||||
:class:`contextlib.AbstractAsyncContextManager`
|
||||
now supports subscripting (``[]``).
|
||||
See :pep:`585` and :ref:`types-genericalias`.
|
||||
|
||||
Protocols
|
||||
---------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue