Skip to content

Support frozen=TYPE_CHECKING for dataclasses #16224

Open
@MGChecker

Description

@MGChecker

Feature

In a project I am working on, we would like to be able to annotate dataclasses such that usually, there values should not be changed, while allowing to do so at runtime (for some construction methods and testing, more or less.

To do so, we would like to specify @dataclasses.dataclass(frozen=typing.TYPE_CHECKING)

Pitch

This could help to detect misuse of classes without introducing strict runtime guarantees.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions