Skip to content

Commit da5e947

Browse files
TomFaulknerericvsmith
authored andcommitted
Dataclasses: Fix example on 30.6.8, add method should receive a list rather than an integer. (GH-8038)
Change example function to append rather than add lists.
1 parent 9cffdbf commit da5e947

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Doc/library/dataclasses.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ Mutable default values
532532
class C:
533533
x = []
534534
def add(self, element):
535-
self.x += element
535+
self.x.append(element)
536536

537537
o1 = C()
538538
o2 = C()

0 commit comments

Comments
 (0)