@dataclass — the class shape AI ships in every modern Python project — step 7 of 9
AI wrote a Coord dataclass meant to be a value object — never
mutated after construction. The decorator is plain @dataclass,
which leaves it mutable, so the line origin.x = 999 silently
succeeds when it shouldn't.
Add frozen=True to the decorator on line 3 so the assignment
raises FrozenInstanceError. The except block catches it and prints
the class name.
Expected output:
blocked: FrozenInstanceError
AI wrote a Coord dataclass meant to be a value object — never
mutated after construction. The decorator is plain @dataclass,
which leaves it mutable, so the line origin.x = 999 silently
succeeds when it shouldn't.
Add frozen=True to the decorator on line 3 so the assignment
raises FrozenInstanceError. The except block catches it and prints
the class name.
Expected output:
blocked: FrozenInstanceError
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.