4 ms·
I just spend two days chasing a bug because someone shoved a variable inside a dataclass in the wrong place, nothing is immutable in python.
by postit 6y ago
I just spend two days chasing a bug because someone shoved a variable inside a dataclass in the wrong place, nothing is immutable in python.
- iainmerrick 6y agoNo, strings are immutable, despite the semantic gymnastics this article is performing.
- masklinn 6y agoStrings are immutable on the Python side. On the C size, however, PyUnicode_Resize is part of the PEP 384 Stable ABI and very specifically tries to resize the string in-place (it's normally intended for string-building).
- mcv 6y agoIn javascript I enforce immutability by hitting people over the head when they try to mutate something they're not supposed to.