Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fd510e3

Browse filesBrowse files
miss-islingtonandresdelfino
authored andcommitted
[doc] Use list[int] instead of List[int] (etc.) in a few more places (pythonGH-22524)
This changes a few occurrences left behind by pythonGH-22340. Automerge-Triggered-By: @gvanrossum (cherry picked from commit 7f54e56) Co-authored-by: Andre Delfino <adelfino@gmail.com>
1 parent d96078b commit fd510e3
Copy full SHA for fd510e3

File tree

2 files changed

+8
-8
lines changed
Filter options

2 files changed

+8
-8
lines changed

‎Doc/library/dataclasses.rst

Copy file name to clipboardExpand all lines: Doc/library/dataclasses.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Module-level decorators, classes, and functions
188188

189189
@dataclass
190190
class C:
191-
mylist: List[int] = field(default_factory=list)
191+
mylist: list[int] = field(default_factory=list)
192192

193193
c = C()
194194
c.mylist += [1, 2, 3]
@@ -301,7 +301,7 @@ Module-level decorators, classes, and functions
301301

302302
@dataclass
303303
class C:
304-
mylist: List[Point]
304+
mylist: list[Point]
305305

306306
p = Point(10, 20)
307307
assert asdict(p) == {'x': 10, 'y': 20}

‎Doc/library/typing.rst

Copy file name to clipboardExpand all lines: Doc/library/typing.rst
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ These can be used as types in annotations using ``[]``, each having a unique syn
661661
and should not be set on instances of that class. Usage::
662662

663663
class Starship:
664-
stats: ClassVar[Dict[str, int]] = {} # class variable
664+
stats: ClassVar[dict[str, int]] = {} # class variable
665665
damage: int = 10 # instance variable
666666

667667
: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
774774
* ``Annotated`` can be used with nested and generic aliases::
775775

776776
T = TypeVar('T')
777-
Vec = Annotated[List[Tuple[T, T]], MaxLen(10)]
777+
Vec = Annotated[list[tuple[T, T]], MaxLen(10)]
778778
V = Vec[int]
779779

780-
V == Annotated[List[Tuple[int, int]], MaxLen(10)]
780+
V == Annotated[list[tuple[int, int]], MaxLen(10)]
781781

782782
.. versionadded:: 3.9
783783

@@ -1540,7 +1540,7 @@ Functions and decorators
15401540
def process(response: None) -> None:
15411541
...
15421542
@overload
1543-
def process(response: int) -> Tuple[int, str]:
1543+
def process(response: int) -> tuple[int, str]:
15441544
...
15451545
@overload
15461546
def process(response: bytes) -> str:
@@ -1664,8 +1664,8 @@ Introspection helpers
16641664
.. class:: ForwardRef
16651665

16661666
A class used for internal typing representation of string forward references.
1667-
For example, ``List["SomeClass"]`` is implicitly transformed into
1668-
``List[ForwardRef("SomeClass")]``. This class should not be instantiated by
1667+
For example, ``list["SomeClass"]`` is implicitly transformed into
1668+
``list[ForwardRef("SomeClass")]``. This class should not be instantiated by
16691669
a user, but may be used by introspection tools.
16701670

16711671
Constant

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.