Skip to content

Commit d79a42a

Browse files
gh-98507: [typing docs] Rephrase "now supports []" to "now supports subscripting" (GH-98508)
(cherry picked from commit e3b9dd8) Co-authored-by: Nikita Sobolev <[email protected]>
1 parent 39e914c commit d79a42a

File tree

1 file changed

+78
-72
lines changed

1 file changed

+78
-72
lines changed

Doc/library/typing.rst

Lines changed: 78 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -631,8 +631,8 @@ These can be used as types in annotations using ``[]``, each having a unique syn
631631
is equivalent to ``Tuple[Any, ...]``, and in turn to :class:`tuple`.
632632

633633
.. deprecated:: 3.9
634-
:class:`builtins.tuple <tuple>` now supports ``[]``. See :pep:`585` and
635-
:ref:`types-genericalias`.
634+
:class:`builtins.tuple <tuple>` now supports subscripting (``[]``).
635+
See :pep:`585` and :ref:`types-genericalias`.
636636

637637
.. data:: Union
638638

@@ -720,8 +720,8 @@ These can be used as types in annotations using ``[]``, each having a unique syn
720720
respectively.
721721

722722
.. deprecated:: 3.9
723-
:class:`collections.abc.Callable` now supports ``[]``. See :pep:`585` and
724-
:ref:`types-genericalias`.
723+
:class:`collections.abc.Callable` now supports subscripting (``[]``).
724+
See :pep:`585` and :ref:`types-genericalias`.
725725

726726
.. versionchanged:: 3.10
727727
``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
827827
.. versionadded:: 3.5.2
828828

829829
.. deprecated:: 3.9
830-
:class:`builtins.type <type>` now supports ``[]``. See :pep:`585` and
831-
:ref:`types-genericalias`.
830+
:class:`builtins.type <type>` now supports subscripting (``[]``).
831+
See :pep:`585` and :ref:`types-genericalias`.
832832

833833
.. data:: Literal
834834

@@ -1597,8 +1597,8 @@ Corresponding to built-in types
15971597
...
15981598

15991599
.. deprecated:: 3.9
1600-
:class:`builtins.dict <dict>` now supports ``[]``. See :pep:`585` and
1601-
:ref:`types-genericalias`.
1600+
:class:`builtins.dict <dict>` now supports subscripting (``[]``).
1601+
See :pep:`585` and :ref:`types-genericalias`.
16021602

16031603
.. class:: List(list, MutableSequence[T])
16041604

@@ -1618,8 +1618,8 @@ Corresponding to built-in types
16181618
return [item for item in vector if item > 0]
16191619

16201620
.. deprecated:: 3.9
1621-
:class:`builtins.list <list>` now supports ``[]``. See :pep:`585` and
1622-
:ref:`types-genericalias`.
1621+
:class:`builtins.list <list>` now supports subscripting (``[]``).
1622+
See :pep:`585` and :ref:`types-genericalias`.
16231623

16241624
.. class:: Set(set, MutableSet[T])
16251625

@@ -1628,16 +1628,17 @@ Corresponding to built-in types
16281628
to use an abstract collection type such as :class:`AbstractSet`.
16291629

16301630
.. deprecated:: 3.9
1631-
:class:`builtins.set <set>` now supports ``[]``. See :pep:`585` and
1632-
:ref:`types-genericalias`.
1631+
:class:`builtins.set <set>` now supports subscripting (``[]``).
1632+
See :pep:`585` and :ref:`types-genericalias`.
16331633

16341634
.. class:: FrozenSet(frozenset, AbstractSet[T_co])
16351635

16361636
A generic version of :class:`builtins.frozenset <frozenset>`.
16371637

16381638
.. deprecated:: 3.9
1639-
:class:`builtins.frozenset <frozenset>` now supports ``[]``. See
1640-
:pep:`585` and :ref:`types-genericalias`.
1639+
:class:`builtins.frozenset <frozenset>`
1640+
now supports subscripting (``[]``).
1641+
See :pep:`585` and :ref:`types-genericalias`.
16411642

16421643
.. note:: :data:`Tuple` is a special form.
16431644

@@ -1651,8 +1652,8 @@ Corresponding to types in :mod:`collections`
16511652
.. versionadded:: 3.5.2
16521653

16531654
.. deprecated:: 3.9
1654-
:class:`collections.defaultdict` now supports ``[]``. See :pep:`585` and
1655-
:ref:`types-genericalias`.
1655+
:class:`collections.defaultdict` now supports subscripting (``[]``).
1656+
See :pep:`585` and :ref:`types-genericalias`.
16561657

16571658
.. class:: OrderedDict(collections.OrderedDict, MutableMapping[KT, VT])
16581659

@@ -1661,8 +1662,8 @@ Corresponding to types in :mod:`collections`
16611662
.. versionadded:: 3.7.2
16621663

16631664
.. deprecated:: 3.9
1664-
:class:`collections.OrderedDict` now supports ``[]``. See :pep:`585` and
1665-
:ref:`types-genericalias`.
1665+
:class:`collections.OrderedDict` now supports subscripting (``[]``).
1666+
See :pep:`585` and :ref:`types-genericalias`.
16661667

16671668
.. class:: ChainMap(collections.ChainMap, MutableMapping[KT, VT])
16681669

@@ -1672,8 +1673,8 @@ Corresponding to types in :mod:`collections`
16721673
.. versionadded:: 3.6.1
16731674

16741675
.. deprecated:: 3.9
1675-
:class:`collections.ChainMap` now supports ``[]``. See :pep:`585` and
1676-
:ref:`types-genericalias`.
1676+
:class:`collections.ChainMap` now supports subscripting (``[]``).
1677+
See :pep:`585` and :ref:`types-genericalias`.
16771678

16781679
.. class:: Counter(collections.Counter, Dict[T, int])
16791680

@@ -1683,8 +1684,8 @@ Corresponding to types in :mod:`collections`
16831684
.. versionadded:: 3.6.1
16841685

16851686
.. deprecated:: 3.9
1686-
:class:`collections.Counter` now supports ``[]``. See :pep:`585` and
1687-
:ref:`types-genericalias`.
1687+
:class:`collections.Counter` now supports subscripting (``[]``).
1688+
See :pep:`585` and :ref:`types-genericalias`.
16881689

16891690
.. class:: Deque(deque, MutableSequence[T])
16901691

@@ -1694,8 +1695,8 @@ Corresponding to types in :mod:`collections`
16941695
.. versionadded:: 3.6.1
16951696

16961697
.. deprecated:: 3.9
1697-
:class:`collections.deque` now supports ``[]``. See :pep:`585` and
1698-
:ref:`types-genericalias`.
1698+
:class:`collections.deque` now supports subscripting (``[]``).
1699+
See :pep:`585` and :ref:`types-genericalias`.
16991700

17001701
Other concrete types
17011702
""""""""""""""""""""
@@ -1756,8 +1757,8 @@ Corresponding to collections in :mod:`collections.abc`
17561757
A generic version of :class:`collections.abc.Set`.
17571758

17581759
.. deprecated:: 3.9
1759-
:class:`collections.abc.Set` now supports ``[]``. See :pep:`585` and
1760-
:ref:`types-genericalias`.
1760+
:class:`collections.abc.Set` now supports subscripting (``[]``).
1761+
See :pep:`585` and :ref:`types-genericalias`.
17611762

17621763
.. class:: ByteString(Sequence[int])
17631764

@@ -1770,8 +1771,8 @@ Corresponding to collections in :mod:`collections.abc`
17701771
annotate arguments of any of the types mentioned above.
17711772

17721773
.. deprecated:: 3.9
1773-
:class:`collections.abc.ByteString` now supports ``[]``. See :pep:`585`
1774-
and :ref:`types-genericalias`.
1774+
:class:`collections.abc.ByteString` now supports subscripting (``[]``).
1775+
See :pep:`585` and :ref:`types-genericalias`.
17751776

17761777
.. class:: Collection(Sized, Iterable[T_co], Container[T_co])
17771778

@@ -1780,32 +1781,32 @@ Corresponding to collections in :mod:`collections.abc`
17801781
.. versionadded:: 3.6.0
17811782

17821783
.. deprecated:: 3.9
1783-
:class:`collections.abc.Collection` now supports ``[]``. See :pep:`585`
1784-
and :ref:`types-genericalias`.
1784+
:class:`collections.abc.Collection` now supports subscripting (``[]``).
1785+
See :pep:`585` and :ref:`types-genericalias`.
17851786

17861787
.. class:: Container(Generic[T_co])
17871788

17881789
A generic version of :class:`collections.abc.Container`.
17891790

17901791
.. deprecated:: 3.9
1791-
:class:`collections.abc.Container` now supports ``[]``. See :pep:`585`
1792-
and :ref:`types-genericalias`.
1792+
:class:`collections.abc.Container` now supports subscripting (``[]``).
1793+
See :pep:`585` and :ref:`types-genericalias`.
17931794

17941795
.. class:: ItemsView(MappingView, AbstractSet[tuple[KT_co, VT_co]])
17951796

17961797
A generic version of :class:`collections.abc.ItemsView`.
17971798

17981799
.. deprecated:: 3.9
1799-
:class:`collections.abc.ItemsView` now supports ``[]``. See :pep:`585`
1800-
and :ref:`types-genericalias`.
1800+
:class:`collections.abc.ItemsView` now supports subscripting (``[]``).
1801+
See :pep:`585` and :ref:`types-genericalias`.
18011802

18021803
.. class:: KeysView(MappingView, AbstractSet[KT_co])
18031804

18041805
A generic version of :class:`collections.abc.KeysView`.
18051806

18061807
.. deprecated:: 3.9
1807-
:class:`collections.abc.KeysView` now supports ``[]``. See :pep:`585`
1808-
and :ref:`types-genericalias`.
1808+
:class:`collections.abc.KeysView` now supports subscripting (``[]``).
1809+
See :pep:`585` and :ref:`types-genericalias`.
18091810

18101811
.. class:: Mapping(Sized, Collection[KT], Generic[VT_co])
18111812

@@ -1816,56 +1817,58 @@ Corresponding to collections in :mod:`collections.abc`
18161817
return word_list[word]
18171818

18181819
.. deprecated:: 3.9
1819-
:class:`collections.abc.Mapping` now supports ``[]``. See :pep:`585`
1820-
and :ref:`types-genericalias`.
1820+
:class:`collections.abc.Mapping` now supports subscripting (``[]``).
1821+
See :pep:`585` and :ref:`types-genericalias`.
18211822

18221823
.. class:: MappingView(Sized)
18231824

18241825
A generic version of :class:`collections.abc.MappingView`.
18251826

18261827
.. deprecated:: 3.9
1827-
:class:`collections.abc.MappingView` now supports ``[]``. See :pep:`585`
1828-
and :ref:`types-genericalias`.
1828+
:class:`collections.abc.MappingView` now supports subscripting (``[]``).
1829+
See :pep:`585` and :ref:`types-genericalias`.
18291830

18301831
.. class:: MutableMapping(Mapping[KT, VT])
18311832

18321833
A generic version of :class:`collections.abc.MutableMapping`.
18331834

18341835
.. deprecated:: 3.9
1835-
:class:`collections.abc.MutableMapping` now supports ``[]``. See
1836-
:pep:`585` and :ref:`types-genericalias`.
1836+
:class:`collections.abc.MutableMapping`
1837+
now supports subscripting (``[]``).
1838+
See :pep:`585` and :ref:`types-genericalias`.
18371839

18381840
.. class:: MutableSequence(Sequence[T])
18391841

18401842
A generic version of :class:`collections.abc.MutableSequence`.
18411843

18421844
.. deprecated:: 3.9
1843-
:class:`collections.abc.MutableSequence` now supports ``[]``. See
1844-
:pep:`585` and :ref:`types-genericalias`.
1845+
:class:`collections.abc.MutableSequence`
1846+
now supports subscripting (``[]``).
1847+
See :pep:`585` and :ref:`types-genericalias`.
18451848

18461849
.. class:: MutableSet(AbstractSet[T])
18471850

18481851
A generic version of :class:`collections.abc.MutableSet`.
18491852

18501853
.. deprecated:: 3.9
1851-
:class:`collections.abc.MutableSet` now supports ``[]``. See :pep:`585`
1852-
and :ref:`types-genericalias`.
1854+
:class:`collections.abc.MutableSet` now supports subscripting (``[]``).
1855+
See :pep:`585` and :ref:`types-genericalias`.
18531856

18541857
.. class:: Sequence(Reversible[T_co], Collection[T_co])
18551858

18561859
A generic version of :class:`collections.abc.Sequence`.
18571860

18581861
.. deprecated:: 3.9
1859-
:class:`collections.abc.Sequence` now supports ``[]``. See :pep:`585`
1860-
and :ref:`types-genericalias`.
1862+
:class:`collections.abc.Sequence` now supports subscripting (``[]``).
1863+
See :pep:`585` and :ref:`types-genericalias`.
18611864

18621865
.. class:: ValuesView(MappingView, Collection[_VT_co])
18631866

18641867
A generic version of :class:`collections.abc.ValuesView`.
18651868

18661869
.. deprecated:: 3.9
1867-
:class:`collections.abc.ValuesView` now supports ``[]``. See :pep:`585`
1868-
and :ref:`types-genericalias`.
1870+
:class:`collections.abc.ValuesView` now supports subscripting (``[]``).
1871+
See :pep:`585` and :ref:`types-genericalias`.
18691872

18701873
Corresponding to other types in :mod:`collections.abc`
18711874
""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -1875,16 +1878,16 @@ Corresponding to other types in :mod:`collections.abc`
18751878
A generic version of :class:`collections.abc.Iterable`.
18761879

18771880
.. deprecated:: 3.9
1878-
:class:`collections.abc.Iterable` now supports ``[]``. See :pep:`585`
1879-
and :ref:`types-genericalias`.
1881+
:class:`collections.abc.Iterable` now supports subscripting (``[]``).
1882+
See :pep:`585` and :ref:`types-genericalias`.
18801883

18811884
.. class:: Iterator(Iterable[T_co])
18821885

18831886
A generic version of :class:`collections.abc.Iterator`.
18841887

18851888
.. deprecated:: 3.9
1886-
:class:`collections.abc.Iterator` now supports ``[]``. See :pep:`585`
1887-
and :ref:`types-genericalias`.
1889+
:class:`collections.abc.Iterator` now supports subscripting (``[]``).
1890+
See :pep:`585` and :ref:`types-genericalias`.
18881891

18891892
.. class:: Generator(Iterator[T_co], Generic[T_co, T_contra, V_co])
18901893

@@ -1918,8 +1921,8 @@ Corresponding to other types in :mod:`collections.abc`
19181921
start += 1
19191922

19201923
.. deprecated:: 3.9
1921-
:class:`collections.abc.Generator` now supports ``[]``. See :pep:`585`
1922-
and :ref:`types-genericalias`.
1924+
:class:`collections.abc.Generator` now supports subscripting (``[]``).
1925+
See :pep:`585` and :ref:`types-genericalias`.
19231926

19241927
.. class:: Hashable
19251928

@@ -1930,8 +1933,8 @@ Corresponding to other types in :mod:`collections.abc`
19301933
A generic version of :class:`collections.abc.Reversible`.
19311934

19321935
.. deprecated:: 3.9
1933-
:class:`collections.abc.Reversible` now supports ``[]``. See :pep:`585`
1934-
and :ref:`types-genericalias`.
1936+
:class:`collections.abc.Reversible` now supports subscripting (``[]``).
1937+
See :pep:`585` and :ref:`types-genericalias`.
19351938

19361939
.. class:: Sized
19371940

@@ -1955,8 +1958,8 @@ Asynchronous programming
19551958
.. versionadded:: 3.5.3
19561959

19571960
.. deprecated:: 3.9
1958-
:class:`collections.abc.Coroutine` now supports ``[]``. See :pep:`585`
1959-
and :ref:`types-genericalias`.
1961+
:class:`collections.abc.Coroutine` now supports subscripting (``[]``).
1962+
See :pep:`585` and :ref:`types-genericalias`.
19601963

19611964
.. class:: AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra])
19621965

@@ -1992,8 +1995,9 @@ Asynchronous programming
19921995
.. versionadded:: 3.6.1
19931996

19941997
.. deprecated:: 3.9
1995-
:class:`collections.abc.AsyncGenerator` now supports ``[]``. See
1996-
:pep:`585` and :ref:`types-genericalias`.
1998+
:class:`collections.abc.AsyncGenerator`
1999+
now supports subscripting (``[]``).
2000+
See :pep:`585` and :ref:`types-genericalias`.
19972001

19982002
.. class:: AsyncIterable(Generic[T_co])
19992003

@@ -2002,8 +2006,8 @@ Asynchronous programming
20022006
.. versionadded:: 3.5.2
20032007

20042008
.. deprecated:: 3.9
2005-
:class:`collections.abc.AsyncIterable` now supports ``[]``. See :pep:`585`
2006-
and :ref:`types-genericalias`.
2009+
:class:`collections.abc.AsyncIterable` now supports subscripting (``[]``).
2010+
See :pep:`585` and :ref:`types-genericalias`.
20072011

20082012
.. class:: AsyncIterator(AsyncIterable[T_co])
20092013

@@ -2012,8 +2016,8 @@ Asynchronous programming
20122016
.. versionadded:: 3.5.2
20132017

20142018
.. deprecated:: 3.9
2015-
:class:`collections.abc.AsyncIterator` now supports ``[]``. See :pep:`585`
2016-
and :ref:`types-genericalias`.
2019+
:class:`collections.abc.AsyncIterator` now supports subscripting (``[]``).
2020+
See :pep:`585` and :ref:`types-genericalias`.
20172021

20182022
.. class:: Awaitable(Generic[T_co])
20192023

@@ -2022,8 +2026,8 @@ Asynchronous programming
20222026
.. versionadded:: 3.5.2
20232027

20242028
.. deprecated:: 3.9
2025-
:class:`collections.abc.Awaitable` now supports ``[]``. See :pep:`585`
2026-
and :ref:`types-genericalias`.
2029+
:class:`collections.abc.Awaitable` now supports subscripting (``[]``).
2030+
See :pep:`585` and :ref:`types-genericalias`.
20272031

20282032

20292033
Context manager types
@@ -2037,8 +2041,9 @@ Context manager types
20372041
.. versionadded:: 3.6.0
20382042

20392043
.. deprecated:: 3.9
2040-
:class:`contextlib.AbstractContextManager` now supports ``[]``. See
2041-
:pep:`585` and :ref:`types-genericalias`.
2044+
:class:`contextlib.AbstractContextManager`
2045+
now supports subscripting (``[]``).
2046+
See :pep:`585` and :ref:`types-genericalias`.
20422047

20432048
.. class:: AsyncContextManager(Generic[T_co])
20442049

@@ -2048,8 +2053,9 @@ Context manager types
20482053
.. versionadded:: 3.6.2
20492054

20502055
.. deprecated:: 3.9
2051-
:class:`contextlib.AbstractAsyncContextManager` now supports ``[]``. See
2052-
:pep:`585` and :ref:`types-genericalias`.
2056+
:class:`contextlib.AbstractAsyncContextManager`
2057+
now supports subscripting (``[]``).
2058+
See :pep:`585` and :ref:`types-genericalias`.
20532059

20542060
Protocols
20552061
---------

0 commit comments

Comments
 (0)