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

This commit is contained in:
Declan 2024-03-09 22:52:57 +01:00 committed by GitHub
parent 1e68c4b876
commit db8f423f58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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