[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: better way than: myPage += 'more html' , ...
From: Oren Tirosh <oren-py-l () hishome ! net>
Date: 2003-06-30 16:01:21
[Download RAW message or body]
On Thu, Jun 26, 2003 at 10:30:21AM +1000, Delaney, Timothy C (Timothy) wrote:
> import cStringIO as StringIO
>
> # Subclass of str so that it can be used nearly anywhere that requires a real
> # string.
>
> class MutableString (str):
...
Making it a subclass of str doesn't do what you want. Lots of places in the
C code access the string buffer directly (for performance) instead of going
through the __str__ method. They will all get the value the string had when
it was created rather than its current value.
There is currently no way to implement a true replacement of the str type in
Python code. Even an extension type is somewhat limited in its ability to
emulate a string.
Oren
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic