classes — reading what ai just wrote you6 / 9
@dataclass — the class shape ai ships in every modern python project
Claude wrote a dataclass with a literal [] as a default. The class
definition itself raises ValueError: mutable default .... The fix
is field(default_factory=list).
field is already imported on line 1. Replace the broken default on
line 6 so the class defines successfully and the print at the bottom
shows an empty list per instance.
Expected output:
Inbox(owner='maya', messages=[])
Inbox(owner='marcus', messages=[])
The break is on line 6 — but read the whole snippet first.
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _