Skip to content

Commit bcea15a

Browse files
miss-islingtonTomFaulkner
authored andcommitted
Dataclasses: Fix example on 30.6.8, add method should receive a list rather than an integer. (GH-8038) (GH-8237)
Change example function to append rather than add lists. (cherry picked from commit da5e947) Co-authored-by: Tom Faulkner <[email protected]>
1 parent c87b1aa commit bcea15a

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
@@ -533,7 +533,7 @@ Mutable default values
533533
class C:
534534
x = []
535535
def add(self, element):
536-
self.x += element
536+
self.x.append(element)
537537

538538
o1 = C()
539539
o2 = C()

0 commit comments

Comments
 (0)