8000 gh-98507: [typing docs] Rephrase "now supports `[]`" to "now supports… · python/cpython@cdbfce1 · GitHub
[go: up one dir, main page]

Skip to content

Commit cdbfce1

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 <mail@sobolevn.me>
1 parent 36d25a4 commit cdbfce1

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
@@ -760,8 +760,8 @@ These can be used as types in annotations using ``[]``, each having a unique syn
760760
is equivalent to ``Tuple[Any, ...]``, and in turn to :class:`tuple`.
761761

762762
.. deprecated:: 3.9
763-
:class:`builtins.tuple <tuple>` now supports ``[]``. See :pep:`585` and
764-
:ref:`types-genericalias`.
763+
:class:`builtins.tuple <tuple>` now supports subscripting (``[]``).
764+
See :pep:`585` and :ref:`types-genericalias`.
765765

766766
.. data:: Union
767767

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

851851
.. deprecated:: 3.9
852-
:class:`collections.abc.Callable` now supports ``[]``. See :pep:`585` and
853-
:ref:`types-genericalias`.
852+
:class:`collections.abc.Callable` now supports subscripting (``[]``).
853+
See :pep:`585` and :ref:`types-genericalias`.
854854

855855
.. versionchanged:: 3.10
856856
``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`.
@@ -957,8 +957,8 @@ These can be used as types in annotations using ``[]``, each having a unique syn
957957
.. versionadded:: 3.5.2
958958

959959
.. deprecated:: 3.9
960-
:class:`builtins.type <type>` now supports ``[]``. See :pep:`585` and
961-
:ref:`types-genericalias`.
960+
:class:`builtins.type <type>` now supports subscripting (``[]``).
961+
See :pep:`585` and :ref:`types-genericalias`.
962962

963963
.. data:: Literal
964964

@@ -1896,8 +1896,8 @@ Corresponding to built-in types
18961896
...
18971897

18981898
.. deprecated:: 3.9
1899-
:class:`builtins.dict <dict>` now supports ``[]``. See :pep:`585` and
1900-
:ref:`types-genericalias`.
1899+
:class:`builtins.dict <dict>` now supports subscripting (``[]``).
1900+
See :pep:`585` and :ref:`types-genericalias`.
19011901

19021902
.. class:: List(list, MutableSequence[T])
19031903

@@ -1917,8 +1917,8 @@ Corresponding to built-in types
19171917
return [item for item in vector if item > 0]
19181918

19191919
.. deprecated:: 3.9
1920-
:class:`builtins.list <list>` now supports ``[]``. See :pep:`585` and
1921-
:ref:`types-genericalias`.
1920+
:class:`builtins.list <list>` now supports subscripting (``[]``).
1921+
See :pep:`585` and :ref:`types-genericalias`.
19221922

19231923
.. class:: Set(set, MutableSet[T])
19241924

@@ -1927,16 +1927,17 @@ Corresponding to built-in types
19271927
to use an abstract collection type such as :class:`AbstractSet`.
19281928

19291929
.. deprecated:: 3.9
1930-
:class:`builtins.set <set>` now supports ``[]``. See :pep:`585` and
1931-
:ref:`types-genericalias`.
1930+
:class:`builtins.set <set>` now supports subscripting (``[]``).
1931+
See :pep:`585` and :ref:`types-genericalias`.
19321932

19331933
.. class:: FrozenSet(frozenset, AbstractSet[T_co])
19341934

19351935
A generic version of :class:`builtins.frozenset <frozenset>`.
19361936

19371937
.. deprecated:: 3.9
1938-
:class:`builtins.frozenset <frozenset>` now supports ``[]``. See
1939-
:pep:`585` and :ref:`types-genericalias`.
1938+
:class:`builtins.frozenset <frozenset>`
1939+
now supports subscripting (``[]``).
1940+
See :pep:`585` and :ref:`types-genericalias`.
19401941

19411942
.. note:: :data:`Tuple` is a special form.
19421943

@@ -1950,8 +1951,8 @@ Corresponding to types in :mod:`collections`
19501951
.. versionadded:: 3.5.2
19511952

19521953
.. deprecated:: 3.9
1953-
:class:`collections.defaultdict` now supports ``[]``. See :pep:`585` and
1954-
:ref:`types-genericalias`.
1954+
:class:`collections.defaultdict` now supports subscripting (``[]``).
1955+
See :pep:`585` and :ref:`types-genericalias`.
19551956

19561957
.. class:: OrderedDict(collections.OrderedDict, MutableMapping[KT, VT])
19571958

@@ -1960,8 +1961,8 @@ Corresponding to types in :mod:`collections`
19601961
.. versionadded:: 3.7.2
19611962

19621963
.. deprecated:: 3.9
1963-
:class:`collections.OrderedDict` now supports ``[]``. See :pep:`585` and
1964-
:ref:`types-genericalias`.
1964+
:class:`collections.OrderedDict` now supports subscripting (``[]``).
1965+
See :pep:`585` and :ref:`types-genericalias`.
19651966

19661967
.. class:: ChainMap(collections.ChainMap, MutableMapping[KT, VT])
19671968

@@ -1971,8 +1972,8 @@ Corresponding to types in :mod:`collections`
19711972
.. versionadded:: 3.6.1
19721973

19731974
.. deprecated:: 3.9
1974-
:class:`collections.ChainMap` now supports ``[]``. See :pep:`585` and
1975-
:ref:`types-genericalias`.
1975+
:class:`collections.ChainMap` now supports subscripting (``[]``).
1976+
See :pep:`585` and :ref:`types-genericalias`.
19761977

19771978
.. class:: Counter(collections.Counter, Dict[T, int])
19781979

@@ -1982,8 +1983,8 @@ Corresponding to types in :mod:`collections`
19821983
.. versionadded:: 3.6.1
19831984

19841985
.. deprecated:: 3.9
1985-
:class:`collections.Counter` now supports ``[]``. See :pep:`585` and
1986-
:ref:`types-genericalias`.
1986+
:class:`collections.Counter` now supports subscripting (``[]``).
1987+
See :pep:`585` and :ref:`types-genericalias`.
19871988

19881989
.. class:: Deque(deque, MutableSequence[T])
19891990

@@ -1993,8 +1994,8 @@ Corresponding to types in :mod:`collections`
19931994
.. versionadded:: 3.6.1
19941995

19951996
.. deprecated:: 3.9
1996-
:class:`collections.deque` now supports ``[]``. See :pep:`585` and
1997-
:ref:`types-genericalias`.
1997+
:class:`collections.deque` now supports subscripting (``[]``).
1998+
See :pep:`585` and :ref:`types-genericalias`.
19981999

19992000
Other concrete types
20002001
""""""""""""""""""""
@@ -2061,8 +2062,8 @@ Corresponding to collections in :mod:`collections.abc`
20612062
A generic version of :class:`collections.abc.Set`.
20622063

20632064
.. deprecated:: 3.9
2064-
:class:`collections.abc.Set` now supports ``[]``. See :pep:`585` and
2065-
:ref:`types-genericalias`.
2065+
:class:`collections.abc.Set` now supports subscripting (``[]``).
2066+
See :pep:`585` and :ref:`types-genericalias`.
20662067

20672068
.. class:: ByteString(Sequence[int])
20682069

@@ -2075,8 +2076,8 @@ Corresponding to collections in :mod:`collections.abc`
20752076
annotate arguments of any of the types mentioned above.
20762077

20772078
.. deprecated:: 3.9
2078-
:class:`collections.abc.ByteString` now supports ``[]``. See :pep:`585`
2079-
and :ref:`types-genericalias`.
2079+
:class:`collections.abc.ByteString` now supports subscripting (``[]``).
2080+
See :pep:`585` and :ref:`types-genericalias`.
20802081

20812082
.. class:: Collection(Sized, Iterable[T_co], Container[T_co])
20822083

@@ -2085,32 +2086,32 @@ Corresponding to collections in :mod:`collections.abc`
20852086
.. versionadded:: 3.6.0
20862087

20872088
.. deprecated:: 3.9
2088-
:class:`collections.abc.Collection` now supports ``[]``. See :pep:`585`
2089-
and :ref:`types-genericalias`.
2089+
:class:`collections.abc.Collection` now supports subscripting (``[]``).
2090+
See :pep:`585` and :ref:`types-genericalias`.
20902091

20912092
.. class:: Container(Generic[T_co])
20922093

20932094
A generic version of :class:`collections.abc.Container`.
20942095

20952096
.. deprecated:: 3.9
2096-
:class:`collections.abc.Container` now supports ``[]``. See :pep:`585`
2097-
and :ref:`types-genericalias`.
2097+
:class:`collections.abc.Container` now supports subscripting (``[]``).
2098+
See :pep:`585` and :ref:`types-genericalias`.
20982099

20992100
.. class:: ItemsView(MappingView, AbstractSet[tuple[KT_co, VT_co]])
21002101

21012102
A generic version of :class:`collections.abc.ItemsView`.
21022103

21032104
.. deprecated:: 3.9
2104-
:class:`collections.abc.ItemsView` now supports ``[]``. See :pep:`585`
2105-
and :ref:`types-genericalias`.
2105+
:class:`collections.abc.ItemsView` now supports subscripting (``[]``).
2106+
See :pep:`585` and :ref:`types-genericalias`.
21062107

21072108
.. class:: KeysView(MappingView, AbstractSet[KT_co])
21082109

21092110
A generic version of :class:`collections.abc.KeysView`.
21102111

21112112
.. deprecated:: 3.9
2112-
:class:`collections.abc.KeysView` now supports ``[]``. See :pep:`585`
2113-
and :ref:`types-genericalias`.
2113+
:class:`collections.abc.KeysView` now supports subscripting (``[]``).
2114+
See :pep:`585` and :ref:`types-genericalias`.
21142115

21152116
.. class:: Mapping(Sized, Collection[KT], Generic[VT_co])
21162117

@@ -2121,56 +2122,58 @@ Corresponding to collections in :mod:`collections.abc`
21212122
return word_list[word]
21222123

21232124
.. deprecated:: 3.9
2124-
:class:`collections.abc.Mapping` now supports ``[]``. See :pep:`585`
2125-
and :ref:`types-genericalias`.
2125+
:class:`collections.abc.Mapping` now supports subscripting (``[]``).
2126+
See :pep:`585` and :ref:`types-genericalias`.
21262127

21272128
.. class:: MappingView(Sized)
21282129

21292130
A generic version of :class:`collections.abc.MappingView`.
21302131

21312132
.. deprecated:: 3.9
2132-
:class:`collections.abc.MappingView` now supports ``[]``. See :pep:`585`
2133-
and :ref:`types-genericalias`.
2133+
:class:`collections.abc.MappingView` now supports subscripting (``[]``).
2134+
See :pep:`585` and :ref:`types-genericalias`.
21342135

21352136
.. class:: MutableMapping(Mapping[KT, VT])
21362137

21372138
A generic version of :class:`collections.abc.MutableMapping`.
21382139

21392140
.. deprecated:: 3.9
2140-
:class:`collections.abc.MutableMapping` now supports ``[]``. See
2141-
:pep:`585` and :ref:`types-genericalias`.
2141+
:class:`collections.abc.MutableMapping`
2142+
now supports subscripting (``[]``).
2143+
See :pep:`585` and :ref:`types-genericalias`.
21422144

21432145
.. class:: MutableSequence(Sequence[T])
21442146

21452147
A generic version of :class:`collections.abc.MutableSequence`.
21462148

21472149
.. deprecated:: 3.9
2148-
:class:`collections.abc.MutableSequence` now supports ``[]``. See
2149-
:pep:`585` and :ref:`types-genericalias`.
2150+
:class:`collections.abc.MutableSequence`
2151+
now supports subscripting (``[]``).
2152+
See :pep:`585` and :ref:`types-genericalias`.
21502153

21512154
.. class:: MutableSet(AbstractSet[T])
21522155

21532156
A generic version of :class:`collections.abc.MutableSet`.
21542157

21552158
.. deprecated:: 3.9
2156-
:class:`collections.abc.MutableSet` now supports ``[]``. See :pep:`585`
2157-
and :ref:`types-genericalias`.
2159+
:class:`collections.abc.MutableSet` now supports subscripting (``[]``).
2160+
See :pep:`585` and :ref:`types-genericalias`.
21582161

21592162
.. class:: Sequence(Reversible[T_co], Collection[T_co])
21602163

21612164
A generic version of :class:`collections.abc.Sequence`.
21622165

21632166
.. deprecated:: 3.9
2164-
:class:`collections.abc.Sequence` now supports ``[]``. See :pep:`585`
2165-
and :ref:`types-genericalias`.
2167+
:class:`collections.abc.Sequence` now supports subscripting (``[]``).
2168+
See :pep:`585` and :ref:`types-genericalias`.
21662169

21672170
.. class:: ValuesView(MappingView, Collection[_VT_co])
21682171

21692172
A generic version of :class:`collections.abc.ValuesView`.
21702173

21712174
.. deprecated:: 3.9
2172-
:class:`collections.abc.ValuesView` now supports ``[]``. See :pep:`585`
2173-
and :ref:`types-genericalias`.
2175+
:class:`collections.abc.ValuesView` now supports subscripting (``[]``).
2176+
See :pep:`585` and :ref:`types-genericalias`.
21742177

21752178
Corresponding to other types in :mod:`collections.abc`
21762179
""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -2180,16 +2183,16 @@ Corresponding to other types in :mod:`collections.abc`
21802183
A generic version of :class:`collections.abc.Iterable`.
21812184

21822185
.. deprecated:: 3.9
2183-
:class:`collections.abc.Iterable` now supports ``[]``. See :pep:`585`
2184-
and :ref:`types-genericalias`.
2186+
:class:`collections.abc.Iterable` now supports subscripting (``[]``).
2187+
See :pep:`585` and :ref:`types-genericalias`.
21852188

21862189
.. class:: Iterator(Iterable[T_co])
21872190

21882191
A generic version of :class:`collections.abc.Iterator`.
21892192

21902193
.. deprecated:: 3.9
2191-
:class:`collections.abc.Iterator` now supports ``[]``. See :pep:`585`
2192-
and :ref:`types-genericalias`.
2194+
:class:`collections.abc.Iterator` now supports subscripting (``[]``).
2195+
See :pep:`585` and :ref:`types-genericalias`.
21932196

21942197
.. class:: Generator(Iterator[T_co], Generic[T_co, T_contra, V_co])
21952198

@@ -2223,8 +2226,8 @@ Corresponding to other types in :mod:`collections.abc`
22232226
start += 1
22242227

22252228
.. deprecated:: 3.9
2226-
:class:`collections.abc.Generator` now supports ``[]``. See :pep:`585`
2227-
and :ref:`types-genericalias`.
2229+
:class:`collections.abc.Generator` now supports subscripting (``[]``).
2230+
See :pep:`585` and :ref:`types-genericalias`.
22282231

22292232
.. class:: Hashable
22302233

@@ -2235,8 +2238,8 @@ Corresponding to other types in :mod:`collections.abc`
22352238
A generic version of :class:`collections.abc.Reversible`.
22362239

22372240
.. deprecated:: 3.9
2238-
:class:`collections.abc.Reversible` now supports ``[]``. See :pep:`585`
2239-
and :ref:`types-genericalias`.
2241+
:class:`collections.abc.Reversible` now supports subscripting (``[]``).
2242+
See :pep:`585` and :ref:`types-genericalias`.
22402243

22412244
.. class:: Sized
22422245

@@ -2260,8 +2263,8 @@ Asynchronous programming
22602263
.. versionadded:: 3.5.3
22612264

22622265
.. deprecated:: 3.9
2263-
:class:`collections.abc.Coroutine` now supports ``[]``. See :pep:`585`
2264-
and :ref:`types-genericalias`.
2266+
:class:`collections.abc.Coroutine` now supports subscripting (``[]``).
2267+
See :pep:`585` and :ref:`types-genericalias`.
22652268

22662269
.. class:: AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra])
22672270

@@ -2297,8 +2300,9 @@ Asynchronous programming
22972300
.. versionadded:: 3.6.1
22982301

22992302
.. deprecated:: 3.9
2300-
:class:`collections.abc.AsyncGenerator` now supports ``[]``. See
2301-
:pep:`585` and :ref:`types-genericalias`.
2303+
:class:`collections.abc.AsyncGenerator`
2304+
now supports subscripting (``[]``).
2305+
See :pep:`585` and :ref:`types-genericalias`.
23022306

23032307
.. class:: AsyncIterable(Generic[T_co])
23042308

@@ -2307,8 +2311,8 @@ Asynchronous programming
23072311
.. versionadded:: 3.5.2
23082312

23092313
.. deprecated:: 3.9
2310-
:class:`collections.abc.AsyncIterable` now supports ``[]``. See :pep:`585`
2311-
and :ref:`types-genericalias`.
2314+
:class:`collections.abc.AsyncIterable` now supports subscripting (``[]``).
2315+
See :pep:`585` and :ref:`types-genericalias`.
23122316

23132317
.. class:: AsyncIterator(AsyncIterable[T_co])
23142318

@@ -2317,8 +2321,8 @@ Asynchronous programming
23172321
.. versionadded:: 3.5.2
23182322

23192323
.. deprecated:: 3.9
2320-
:class:`collections.abc.AsyncIterator` now supports ``[]``. See :pep:`585`
2321-
and :ref:`types-genericalias`.
2324+
:class:`collections.abc.AsyncIterator` now supports subscripting (``[]``).
2325+
See :pep:`585` and :ref:`types-genericalias`.
23222326

23232327
.. class:: Awaitable(Generic[T_co])
23242328

@@ -2327,8 +2331,8 @@ Asynchronous programming
23272331
.. versionadded:: 3.5.2
23282332

23292333
.. deprecated:: 3.9
2330-
:class:`collections.abc.Awaitable` now supports ``[]``. See :pep:`585`
2331-
and :ref:`types-genericalias`.
2334+
:class:`collections.abc.Awaitable` now supports subscripting (``[]``).
2335+
See :pep:`585` and :ref:`types-genericalias`.
23322336

23332337

23342338
Context manager types
@@ -2342,8 +2346,9 @@ Context manager types
23422346
.. versionadded:: 3.6.0
23432347

23442348
.. deprecated:: 3.9
2345-
:class:`contextlib.AbstractContextManager` now supports ``[]``. See
2346-
:pep:`585` and :ref:`types-genericalias`.
2349+
:class:`contextlib.AbstractContextManager`
2350+
now supports subscripting (``[]``).
2351+
See :pep:`585` and :ref:`types-genericalias`.
23472352

23482353
.. class:: AsyncContextManager(Generic[T_co])
23492354

@@ -2353,8 +2358,9 @@ Context manager types
23532358
.. versionadded:: 3.6.2
23542359

23552360
.. deprecated:: 3.9
2356-
:class:`contextlib.AbstractAsyncContextManager` now supports ``[]``. See
2357-
:pep:`585` and :ref:`types-genericalias`.
2361+
:class:`contextlib.AbstractAsyncContextManager`
2362+
now supports subscripting (``[]``).
2363+
See :pep:`585` and :ref:`types-genericalias`.
23582364

23592365
Protocols
23602366
---------

0 commit comments

Comments
 (0)
0