mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
gh-116535: Fix distracting "TypeError" in example code (gh-116538)
This commit is contained in:
parent
1e68c4b876
commit
db8f423f58
1 changed files with 2 additions and 2 deletions
|
@ -719,7 +719,7 @@ Using dataclasses, *if* this code was valid::
|
||||||
class D:
|
class D:
|
||||||
x: list = [] # This code raises ValueError
|
x: list = [] # This code raises ValueError
|
||||||
def add(self, element):
|
def add(self, element):
|
||||||
self.x += element
|
self.x.append(element)
|
||||||
|
|
||||||
it would generate code similar to::
|
it would generate code similar to::
|
||||||
|
|
||||||
|
@ -728,7 +728,7 @@ it would generate code similar to::
|
||||||
def __init__(self, x=x):
|
def __init__(self, x=x):
|
||||||
self.x = x
|
self.x = x
|
||||||
def add(self, element):
|
def add(self, element):
|
||||||
self.x += element
|
self.x.append(element)
|
||||||
|
|
||||||
assert D().x is D().x
|
assert D().x is D().x
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue