https://github.com/python/cpython/commit/db8f423f58e336eb6180a70d9886b443d7203c2c
commit: db8f423f58e336eb6180a70d9886b443d7203c2c
branch: main
author: Declan <[email protected]>
committer: ericvsmith <[email protected]>
date: 2024-03-09T16:52:57-05:00
summary:

gh-116535: Fix distracting "TypeError" in example code (gh-116538)

files:
M Doc/library/dataclasses.rst

diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst
index 4ada69d63abada..c612c138fc6ea8 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
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to