gh-99026 update dataclasses docs for when annotations are inspected (gh-100798)

update dataclasses docs for when annotations are inspected
This commit is contained in:
Akshit Tyagi 2023-01-06 19:56:44 +05:30 committed by GitHub
parent 2f2fa03ff3
commit 659c2607f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -552,7 +552,7 @@ parameters to :meth:`__post_init__`. Also see the warning about how
Class variables Class variables
--------------- ---------------
One of two places where :func:`dataclass` actually inspects the type One of the few places where :func:`dataclass` actually inspects the type
of a field is to determine if a field is a class variable as defined of a field is to determine if a field is a class variable as defined
in :pep:`526`. It does this by checking if the type of the field is in :pep:`526`. It does this by checking if the type of the field is
``typing.ClassVar``. If a field is a ``ClassVar``, it is excluded ``typing.ClassVar``. If a field is a ``ClassVar``, it is excluded
@ -563,7 +563,7 @@ module-level :func:`fields` function.
Init-only variables Init-only variables
------------------- -------------------
The other place where :func:`dataclass` inspects a type annotation is to Another place where :func:`dataclass` inspects a type annotation is to
determine if a field is an init-only variable. It does this by seeing determine if a field is an init-only variable. It does this by seeing
if the type of a field is of type ``dataclasses.InitVar``. If a field if the type of a field is of type ``dataclasses.InitVar``. If a field
is an ``InitVar``, it is considered a pseudo-field called an init-only is an ``InitVar``, it is considered a pseudo-field called an init-only