If you don’t want anybody to adjust the attributes of a class, use @dataclass(frozen=True)
.
In the example above, changing the attribute color of the DataClassDog
‘s instance will throw an error.
If you don’t want anybody to adjust the attributes of a class, use @dataclass(frozen=True)
.
In the example above, changing the attribute color of the DataClassDog
‘s instance will throw an error.