Skip to content

Commit 0d5455f

Browse files
miss-islingtondec1
andauthored
[3.12] gh-116535: Fix distracting "TypeError" in example code (gh-116538) (gh-116551)
gh-116535: Fix distracting "TypeError" in example code (gh-116538) (cherry picked from commit db8f423) Co-authored-by: Declan <[email protected]>
1 parent 9f21f03 commit 0d5455f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/library/dataclasses.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ Using dataclasses, *if* this code was valid::
717717
class D:
718718
x: list = [] # This code raises ValueError
719719
def add(self, element):
720-
self.x += element
720+
self.x.append(element)
721721

722722
it would generate code similar to::
723723

@@ -726,7 +726,7 @@ it would generate code similar to::
726726
def __init__(self, x=x):
727727
self.x = x
728728
def add(self, element):
729-
self.x += element
729+
self.x.append(element)
730730

731731
assert D().x is D().x
732732

0 commit comments

Comments
 (0)