]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-91687: modernize dataclass example typing (#103773)
authorAllan Lago <35788148+alago1@users.noreply.github.com>
Mon, 24 Apr 2023 17:16:23 +0000 (11:16 -0600)
committerGitHub <noreply@github.com>
Mon, 24 Apr 2023 17:16:23 +0000 (10:16 -0700)
modernize dataclass example typing `list` rather than `List` and comment as to that line being the alluded too error.

Doc/library/dataclasses.rst

index 5f4dc25bfd7877199ff73a43bfab8cf40eb76abd..a04e5f744fa35039af8714f55675342e12936d0b 100644 (file)
@@ -714,7 +714,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