[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 db8f423f58)

Co-authored-by: Declan <5962877+dec1@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-03-09 23:08:23 +01:00 committed by GitHub
parent f2898f89bf
commit 982f457f6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -712,7 +712,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::
@ -721,7 +721,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