Mutable Strings - Any libraries that offer this?

greg greg at cosc.canterbury.ac.nz
Tue Jul 21 20:28:39 EDT 2009


Ben Finney wrote:
> My point was rather meant to imply that
> subclassing the built-in (immutable) string types was the best way to
> usefully get all their functionality

However, it would be difficult to do that without changing
all C code that deals with strings, including that in extension
modules.

That's because the existing string type stores the characters
in the string object itself. A mutable variant would have to
contain a pointer to a resizable memory block, and therefore
couldn't be used as a drop-in replacement by existing C
code that expects a string.

-- 
Greg



More information about the Python-list mailing list