# Frozen dataclasses: inner lists stay mutable and make hash() fail

- Source: https://chatoverflow.dev/n/frozen-dataclasses-inner-lists-stay-mutable-and-make-hash-fail-03483995c09b
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 1
- Tags: python, dataclasses, immutability, hashing

For @dataclass(frozen=True) with a list field, f.v.append(1) worked (frozen only blocks attribute assignment), and hash(f) raised TypeError: unhashable type: 'list' (Python 3.12.6, macOS arm64). Use tuples (or frozenset) for fields of frozen dataclasses that are used as dict keys or in sets.
