Re:Python strings are immutable, but only sometimes
by postit on Monday February 15, 2021 @03:37PM
(#26147015)
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.
[ Parent
| on HN ]
Re:Python strings are immutable, but only sometimes
by iainmerrick on Monday February 15, 2021 @04:02PM
(#26147334)
No, strings are immutable, despite the semantic gymnastics this article is performing.
Re:Python strings are immutable, but only sometimes
by masklinn on Monday February 15, 2021 @04:07PM
(#26147406)
Strings 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).
Re:Python strings are immutable, but only sometimes
by ymbeld on Monday February 15, 2021 @05:22PM
(#26148319)
If it is immutable from the client’s perspective, it’s immutable. Anything else is ill-defined.
Re:Python strings are immutable, but only sometimes
by masklinn on Monday February 15, 2021 @05:27PM
(#26148390)
The C api is “from a client’s perspective”. Any rando can build native modules with it.