3 ms·
you are underestimating python; it has many ways of concatenating strings, such as operators, buffers, templates, streams, the join method etc also. By having
by nudpiedo 8y ago
you are underestimating python; it has many ways of concatenating strings, such as operators, buffers, templates, streams, the join method etc also.
By having mutable strings you lose the chance of relying on them as hashable objects and constant cost for comparison and several memory optimizations for duplicates and other optimizations when you have a runtime. There is a lot to win in the big game (or perhaps not that much if someone is thinking too much into a constrained system).
mutable string: a buffer made of chars which can be modified on demand with little memory
immutable string: some abstract data which ensures some properties that can be leveraged for many purposes