8000 [3.11] gh-116535: Fix distracting "TypeError" in example code (gh-116… · python/cpython@982f457 · GitHub
[go: up one dir, main page]

Skip to content

Commit 982f457

Browse files
miss-islingtondec1
andauthored
[3.11] gh-116535: Fix distracting "TypeError" in example code (gh-116538) (gh-116552)
gh-116535: Fix distracting "TypeError" in example code (gh-116538) (cherry picked from commit db8f423) Co-authored-by: Declan <5962877+dec1@users.noreply.github.com>
1 parent f2898f8 commit 982f457

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/library/dataclasses.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ Using dataclasses, *if* this code was valid::
712712
class D:
713713
x: list = [] # This code raises ValueError
714714
def add(self, element):
715-
self.x += element
715+
self.x.append(element)
716716

717717
it would generate code similar to::
718718

@@ -721,7 +721,7 @@ it would generate code similar to::
721721
def __init__(self, x=x):
722722
self.x = x
723723
def add(self, element):
724-
self.x += element
724+
self.x.append(element)
725725

726726
assert D().x is D().x
727727

0 commit comments

Comments
 (0)
0