]> granicus.if.org Git - python/commitdiff
Dataclasses: Fix example on 30.6.8, add method should receive a list rather than...
authorTom Faulkner <tomfaulkner@gmail.com>
Wed, 11 Jul 2018 02:39:57 +0000 (21:39 -0500)
committerEric V. Smith <ericvsmith@users.noreply.github.com>
Wed, 11 Jul 2018 02:39:57 +0000 (22:39 -0400)
Change example function to append rather than add lists.

Doc/library/dataclasses.rst

index b26f6422db917aa030012f9b93e11fc23dae63e3..9e3c792fd106c7db25052bd8db711cd49d6ca5bb 100644 (file)
@@ -532,7 +532,7 @@ Mutable default values
      class C:
          x = []
          def add(self, element):
-             self.x += element
+             self.x.append(element)
 
      o1 = C()
      o2 = C()