in-place string reversal

Sathyaish sathyaish at gmail.com
Tue Mar 28 09:29:45 EST 2006


>But what's got that to do with it? Strings are very mutable in C.

I realized after posting that I'd said something incorrect again. The
concept of "mutability" itself is a high-level concept compared to C.
Memory allocation for strings is expensive because of the way malloc()
works to find a "best-fit" against a "first-fit" in traditional memory
management systems. Because of the performance hit, high level
languages and frameworks, such as the Common Type System of the .NET
Framework for example, considers strings as immutable. That, unlike
Python, doesn't however, make them impossible to modify in-place.




More information about the Python-list mailing list