Comment by parpfish
1 day ago
In typed languages, I’m all about using nice safe immutable variables/values.
But in python, everything is mutable so there’s only so much safety you can wring out of adhering the an immutable style. Any other function can hop in and start mutating things (even your “private” attributes). Plan for mutations occurring everywhere.
I find the fewer mutations the easier code is to understand, at the level of an individual function.
Of course you do not have the safety you would have in a language that enforces immutability, but there is still a cost (in terms of maintenance and the likelihood of bugs) to mutation.