From: Robert Feldt Date: 2003-08-19T02:46:00+09:00 Subject: Re: Question: immutable strings as design goal? Hannu Kankaanp粐 skrev den Tue, 19 Aug 2003 02:21:32 +0900: > 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. > ;) In so far as I use Ruby you mean? I didn't want to give the impression that I'm smarter because I use Ruby, but I've seriously tried to switch over to Python and find it harder cause it makes me feel more restricted. But let's not get into a flame war comparing languages (although I must say Guido has a responsability as a representant for Python so why should he go around "dissing" Ruby, at least thats the way his blog comes out to me). > 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? > Agreed, and I probably was exaggerating a bit. There are other things than the indentation requirement and immutable strings that I was thinking of. But overall I'd say they are very similar so the LFM/LSP debate was not a good metaphor. > 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. > Ok, fair enough. Regards, Robert