Hacker News new | ask | show | jobs
by 4ec0755f5522 1838 days ago
I use attrs for this. The objects are not truly immutable in the sense that you can modify then if you are really determined to but typical assignment of a new value to a attrs defined field (where frozen=True) will raise an error.

https://www.attrs.org/en/stable/examples.html#immutability