From: hanzspam@... (=?ISO-8859-1?Q?Hannu_Kankaanp=E4=E4?=) Date: 2003-08-19T02:21:32+09:00 Subject: Re: Question: immutable strings as design goal? Robert Feldt wrote in message news:... > This points to an important "philosophical" difference that stands > out to me when comparing Ruby and Python: Python gives me the feeling of > trying to be a "Language for the Masses" (LFM) and tries to put > restrictions on what can be done. You need to format your code in a certain > way, your strings (but only a minority of other objects) are immutable by > default etc. As discussed on ll1-discuss mailing list and > other places LFM's are in contrast to LFSP's (Language for Smart People / > experts) that tries to give you as much power as possible. This is not the reason Python's strings are immutable, and I don't generally even agree that there's such difference between Python and Ruby (LFM vs LFSP). You're probably just trying to flatter yourself. Python is also a rather unsafe language that lets you do several dangerous but powerful things. Such as redefining functions, classes or objects, or accessing any member in a class. Also, What language doesn't force you to format your code in a certain way? A language with no syntax perhaps? Ruby forces you to use do/end or {} (or something), Python uses indentation -- not a real difference, don't you think? Strings, numbers and tuples are immutable in Python so that they can be used as dictionary keys. I admit that one could do away with this restriction by just choosing not to alter strings that are used as dictionary keys. But allowing this to be done could lead to subtle bugs, and making strings immutable doesn't do much harm, so why not make them immutable? It's actually just a design choice that weighted, which would lead to shorter dev times in general: immutable or mutable strings. Guido thought it was the former.