Why are strings immutable?

John Roth newsgroups at jhrothjr.com
Sat Aug 21 17:34:54 CEST 2004


"Brent W. Hughes" <brent.hughes at comcast.net> wrote in message
news:chzVc.288437$a24.71659 at attbi_s03...
> I kind of hate to have to convert a string into a list, manipulate it, and
> then convert it back into a string.  Why not make strings mutable?

Strings are immutable because they are "value objects".
Consult any good, recent OO design text for what a
value object is, and why it should be immutable.

That said, it would be useful to have a
string buffer object that could be changed.

John Roth
>
>





More information about the Python-list mailing list