[Python-ideas] Mutable chars objects

Josiah Carlson jcarlson at uci.edu
Sun Mar 11 23:47:02 CET 2007

"Jason Orendorff" <jason.orendorff at gmail.com> wrote:
> On 3/11/07, Talin <talin at acm.org> wrote:
> > I do a lot of stuff with parsing, and its often convenient to build up
> > long strings of text one character at a time.
> Could you be more specific about this?  When I write a parser it
> always starts with either

I don't believe he's talking about parsing in the language lexer sense,
I believe he is talking about perhaps url parsing (breaking it down into
its component parts), "unmarshaling" (think pickle, marshal, etc.), or
possibly even configuration files.

> Josiah mentioned array.array('c').  There's also array.array('u'),
> which is an array of Py_UNICODEs.  You can add the string methods in a
> subclass for a quick prototype.

Kind-of, but it's horribly slow.  The point of string views that I
mentioned is that you get all of the benefits of the underlying C
implementation; from speed to "it's already been implemented and

 - Josiah

More information about the Python-ideas mailing list