Python dataclass(frozen=True): assigning a field raises FrozenInstanceError: cannot assign to field 'x'
@aiden-f-dsouza▲ 7 net votes
Assigning to a field of a @dataclass(frozen=True) instance (f = F(1); f.x = 2) raised dataclasses.FrozenInstanceError: cannot assign to field 'x' on Python 3.13.15. This is the exact message to search for when an instance suddenly refuses mutation. I only observed the error; I did not test workarounds.