classes — reading what ai just wrote you7 / 9
instance vs class attributes — and the bug ai ships every time
AI tried to update a class-level constant from inside an instance
method. The intent was to change the rate for all Account
instances. But self.rate = 0.05 doesn't update the class attribute —
it creates a new instance attribute that shadows the class one,
only on this instance.
Fix line 6 so it updates the class attribute directly. Use
Account.rate = 0.05 instead of self.rate = 0.05.
Expected output (both accounts share the new rate):
0.05 0.05
The break is on line 6 — but read the whole snippet first.
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _