You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It should be allowed to declare a read-only (final) dataclass attribute:
@dataclassclassA:
x: Final[str] # error: Final name must be initialized with a value [misc]
Pitch
I think it's a common scenario where a dataclass attribute should be read-only once the dataclass has been instantiated. It works fine with a default value
Feature
It should be allowed to declare a read-only (final) dataclass attribute:
Pitch
I think it's a common scenario where a dataclass attribute should be read-only once the dataclass has been instantiated. It works fine with a default value
and with a regular class:
See the full example on the mypy playground.
The text was updated successfully, but these errors were encountered: