You can make dataclass fields immutable by setting frozen=True.
In this case, fields cannot be mutated after the instance is created.
Example below👇
from dataclasses import dataclass
@dataclass(frozen=True)
class Color:
name: str
hex_value: str
color = Color("red", "#FF0000")
# color.name = "blue" # will raise FrozenInstanceError
👉 @codeprogrammer
