Mutable Strings - Any libraries that offer this?

Ben Finney ben+python at benfinney.id.au
Tue Jul 21 04:38:31 EDT 2009


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:

> On Mon, 20 Jul 2009 21:08:22 +1000, Ben Finney wrote:
> > A mutable string would not (AFAICT) be usefully implementable as a
> > subclass of the built-in string types. So even if such a type
> > existed, it would not be useable with all the functionality that
> > works with strings.
> 
> If applications ignore duck-typing and do isinstance(value, str), it's
> arguably the application and not the value that is broken.

Agreed, I wouldn't advise that. 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, rather than re-implementing most
of it.

-- 
 \     “I went to a restaurant that serves ‘breakfast at any time’. So |
  `\    I ordered French Toast during the Renaissance.” —Steven Wright |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list