[Python-checkins] [doc] Use list[int] instead of List[int] (etc.) in a few more places (GH-22524)
Miss Skeleton (bot)
webhook-mailer at python.org
Sat Oct 3 18:33:45 EDT 2020
https://github.com/python/cpython/commit/5f9a08d95f5c37dad901d5321e0b35928328d8d8
commit: 5f9a08d95f5c37dad901d5321e0b35928328d8d8
branch: 3.9
author: Miss Skeleton (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-10-03T15:33:30-07:00
summary:
[doc] Use list[int] instead of List[int] (etc.) in a few more places (GH-22524)
This changes a few occurrences left behind by GH-22340.
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 7f54e563dc150cd670ca8df678437455c3a7f2cd)
Co-authored-by: Andre Delfino <adelfino at gmail.com>
files:
M Doc/library/dataclasses.rst
M Doc/library/typing.rst
diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst
index 6e74af062d9e7..e706f7fcc566d 100644
--- a/Doc/library/dataclasses.rst
+++ b/Doc/library/dataclasses.rst
@@ -188,7 +188,7 @@ Module-level decorators, classes, and functions
@dataclass
class C:
- mylist: List[int] = field(default_factory=list)
+ mylist: list[int] = field(default_factory=list)
c = C()
c.mylist += [1, 2, 3]
@@ -301,7 +301,7 @@ Module-level decorators, classes, and functions
@dataclass
class C:
- mylist: List[Point]
+ mylist: list[Point]
p = Point(10, 20)
assert asdict(p) == {'x': 10, 'y': 20}
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index bd6814f820120..3900e49679a38 100644
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -661,7 +661,7 @@ These can be used as types in annotations using ``[]``, each having a unique syn
and should not be set on instances of that class. Usage::
class Starship:
- stats: ClassVar[Dict[str, int]] = {} # class variable
+ stats: ClassVar[dict[str, int]] = {} # class variable
damage: int = 10 # instance variable
:data:`ClassVar` accepts only types and cannot be further subscribed.
@@ -774,10 +774,10 @@ These can be used as types in annotations using ``[]``, each having a unique syn
* ``Annotated`` can be used with nested and generic aliases::
T = TypeVar('T')
- Vec = Annotated[List[Tuple[T, T]], MaxLen(10)]
+ Vec = Annotated[list[tuple[T, T]], MaxLen(10)]
V = Vec[int]
- V == Annotated[List[Tuple[int, int]], MaxLen(10)]
+ V == Annotated[list[tuple[int, int]], MaxLen(10)]
.. versionadded:: 3.9
@@ -1540,7 +1540,7 @@ Functions and decorators
def process(response: None) -> None:
...
@overload
- def process(response: int) -> Tuple[int, str]:
+ def process(response: int) -> tuple[int, str]:
...
@overload
def process(response: bytes) -> str:
@@ -1664,8 +1664,8 @@ Introspection helpers
.. class:: ForwardRef
A class used for internal typing representation of string forward references.
- For example, ``List["SomeClass"]`` is implicitly transformed into
- ``List[ForwardRef("SomeClass")]``. This class should not be instantiated by
+ For example, ``list["SomeClass"]`` is implicitly transformed into
+ ``list[ForwardRef("SomeClass")]``. This class should not be instantiated by
a user, but may be used by introspection tools.
Constant
More information about the Python-checkins
mailing list