From: Declan <5962877+dec1@users.noreply.github.com> Date: Sat, 9 Mar 2024 21:52:57 +0000 (+0100) Subject: gh-116535: Fix distracting "TypeError" in example code (gh-116538) X-Git-Tag: v3.13.0a5~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=db8f423f58e336eb6180a70d9886b443d7203c2c;p=thirdparty%2FPython%2Fcpython.git gh-116535: Fix distracting "TypeError" in example code (gh-116538) --- diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 4ada69d63aba..c612c138fc6e 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -719,7 +719,7 @@ Using dataclasses, *if* this code was valid:: class D: x: list = [] # This code raises ValueError def add(self, element): - self.x += element + self.x.append(element) it would generate code similar to:: @@ -728,7 +728,7 @@ it would generate code similar to:: def __init__(self, x=x): self.x = x def add(self, element): - self.x += element + self.x.append(element) assert D().x is D().x