]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Dataclasses: Fix example on 30.6.8, add method should receive a list rather than...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 11 Jul 2018 10:11:11 +0000 (03:11 -0700)
committerEric V. Smith <ericvsmith@users.noreply.github.com>
Wed, 11 Jul 2018 10:11:11 +0000 (06:11 -0400)
Change example function to append rather than add lists.
(cherry picked from commit da5e9476bbfbe61f7661fd22caba1b675e5b4397)

Co-authored-by: Tom Faulkner <tomfaulkner@gmail.com>
Doc/library/dataclasses.rst

index 9835c480d0ea558fa09a2beefc0b58b0e0f57c87..e9af20a04af167a5d5ebe20b3365cde10d1018d4 100644 (file)
@@ -533,7 +533,7 @@ Mutable default values
      class C:
          x = []
          def add(self, element):
-             self.x += element
+             self.x.append(element)
 
      o1 = C()
      o2 = C()