John Salerno  <[EMAIL PROTECTED]> wrote:
>Out of curiosity, is there any kind of equivalent in Python to the 
>StringBuilder class in C#? Here's a quick description from the .NET 
>documentation:
>
>"This class represents a string-like object whose value is a mutable 
>sequence of characters. The value is said to be mutable because it can 
>be modified once it has been created by appending, removing, replacing, 
>or inserting characters."

You can get a long way with list of characters wrapped in list() and
"".join(). Seems to me like the main gotcha is to be careful with things
like:
>>> mutable_string = list("initial\nvalue")
>>> mutable_string[7] = "\r\n"
and make sure you do:
>>> mutable_string[7:8] = "\r\n"

(Although note that you have to spell find() and other string
methods "".join(mutable_string).find("value").)

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to