]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-98576: Fix types in dataclass.InitVar example (gh-98577)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 31 Oct 2022 15:08:54 +0000 (08:08 -0700)
committerGitHub <noreply@github.com>
Mon, 31 Oct 2022 15:08:54 +0000 (08:08 -0700)
(cherry picked from commit 880bafc574bcd811dd7244f9a82056430b489996)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Doc/library/dataclasses.rst

index 02de64288d0d0b5193bb3c162f9c0e289f8cf705..f66010082ad1bbc2d43c3fb3202f25488f6f1e64 100644 (file)
@@ -561,8 +561,8 @@ value is not provided when creating the class::
   @dataclass
   class C:
       i: int
-      j: int = None
-      database: InitVar[DatabaseType] = None
+      j: int | None = None
+      database: InitVar[DatabaseType | None] = None
 
       def __post_init__(self, database):
           if self.j is None and database is not None: