[Python-checkins] Dataclasses: Fix example on 30.6.8, add method should receive a list rather than an integer. (GH-8038)

Eric V. Smith webhook-mailer at python.org
Tue Jul 10 22:40:07 EDT 2018


https://github.com/python/cpython/commit/da5e9476bbfbe61f7661fd22caba1b675e5b4397
commit: da5e9476bbfbe61f7661fd22caba1b675e5b4397
branch: master
author: Tom Faulkner <tomfaulkner at gmail.com>
committer: Eric V. Smith <ericvsmith at users.noreply.github.com>
date: 2018-07-10T22:39:57-04:00
summary:

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.

files:
M Doc/library/dataclasses.rst

diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst
index b26f6422db91..9e3c792fd106 100644
--- a/Doc/library/dataclasses.rst
+++ b/Doc/library/dataclasses.rst
@@ -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()



More information about the Python-checkins mailing list