mirror of
https://github.com/python/cpython.git
synced 2026-01-23 23:59:00 +00:00
[3.11] gh-91687: modernize dataclass example typing (GH-103773) (#103774)
modernize dataclass example typing `list` rather than `List` and comment
as to that line being the alluded too error.
(cherry picked from commit 7ef614c1ad)
Co-authored-by: Allan Lago <35788148+alago1@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
parent
05a25867ae
commit
026c3e9cc4
1 changed files with 1 additions and 1 deletions
|
|
@ -712,7 +712,7 @@ Using dataclasses, *if* this code was valid::
|
|||
|
||||
@dataclass
|
||||
class D:
|
||||
x: List = []
|
||||
x: list = [] # This code raises ValueError
|
||||
def add(self, element):
|
||||
self.x += element
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue