summaryrefslogtreecommitdiffstats
path: root/Doc/library/dataclasses.rst
diff options
context:
space:
mode:
authorDeclan <5962877+dec1@users.noreply.github.com>2024-03-09 21:52:57 (GMT)
committerGitHub <noreply@github.com>2024-03-09 21:52:57 (GMT)
commitdb8f423f58e336eb6180a70d9886b443d7203c2c (patch)
tree4f14f9cd493cc131c808c795e93a7bbbd9fe877d /Doc/library/dataclasses.rst
parent1e68c4b87633b17da1b602b86f5d23bbe106398f (diff)
downloadcpython-db8f423f58e336eb6180a70d9886b443d7203c2c.zip
cpython-db8f423f58e336eb6180a70d9886b443d7203c2c.tar.gz
cpython-db8f423f58e336eb6180a70d9886b443d7203c2c.tar.bz2
gh-116535: Fix distracting "TypeError" in example code (gh-116538)
Diffstat (limited to 'Doc/library/dataclasses.rst')
-rw-r--r--Doc/library/dataclasses.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst
index 4ada69d..c612c13 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