]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-91687: modernize dataclass example typing (GH-103773) (#103774)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 25 Apr 2023 16:16:05 +0000 (09:16 -0700)
committerGitHub <noreply@github.com>
Tue, 25 Apr 2023 16:16:05 +0000 (18:16 +0200)
modernize dataclass example typing `list` rather than `List` and comment
as to that line being the alluded too error.
(cherry picked from commit 7ef614c1adad2b8857442bf0fea649891b591109)

Co-authored-by: Allan Lago <35788148+alago1@users.noreply.github.com>
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Doc/library/dataclasses.rst

index 0a34b996181d584824e55a680e1380e952b8af9e..58bf96bf4f06a1533ba28aea5683ad8663d3c5f0 100644 (file)
@@ -712,7 +712,7 @@ Using dataclasses, *if* this code was valid::
 
   @dataclass
   class D:
-      x: List = []
+      x: list = []      # This code raises ValueError
       def add(self, element):
           self.x += element