Skip to content

gh-97799: use inspect.get_annotations in dataclass - #97800

Merged
larryhastings merged 1 commit into
python:mainfrom
larryhastings:dataclasses_use_inspect_get_annotations
Oct 3, 2022
Merged

larryhastings merged 1 commit into
python:mainfrom
larryhastings:dataclasses_use_inspect_get_annotations

Conversation

@larryhastings

@larryhastings larryhastings commented Oct 3, 2022 •

Copy link
Copy Markdown
Contributor

dataclass used to get the annotations on a class object using cls.__dict__.get('__annotations__'). Now that it always imports inspect, it can use inspect.get_annotations, which is modern best practice for coping with annotations.

dataclass used to get the annotations on a class object using
cls.__dict__.get('__annotations__').  Now that it always imports
inspect, it can use inspect.get_annotations, which is modern
best practice for coping with annotations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants