[Tutor] why strings immutable

Lloyd Hugh Allen lha2@columbia.edu
Fri, 13 Jul 2001 13:54:07 -0500


Sorry to break out of a thread and not reference the message I'm referring to; I'm using pop for reading mail and a web client to write mail, so everything is awkward right now.

Someone had asked, "Why are strings immutable?"

Here's a guess: I recall having read that mutable objects are not allowed to be dictionary keys, and it would be a Good Thing to be able to use strings as dictionary keys (otherwise we'd probably want to call dictionaries something else, if they couldn't hold representations of words).