[Python-Dev] The "lazy strings" patch
jcarlson at uci.edu
Sun Oct 22 00:02:14 CEST 2006
Larry Hastings <larry at hastings.org> wrote:
> I've significantly enhanced my string-concatenation patch, to the point
> where that name is no longer accurate. So I've redubbed it the "lazy
> strings" patch.
Honestly, I don't believe that pure strings should be this complicated.
The implementation of the standard string and unicode type should be as
simple as possible. The current string and unicode implementations are,
in my opinion, as simple as possible given Python's needs.
As such, I don't see a need to go mucking about with the standard string
implementation to make it "lazy" so as to increase performance, reduce
memory consumption, etc.. However, having written a somewhat "lazy"
string slicing/etc operation class I called a "string view", whose
discussion and implementation can be found in the py3k list, I do
believe that having a related type, perhaps with the tree-based
implementation you have written, or a simple pointer + length variant
like I have written, would be useful to have available to Python.
I also believe that it smells like a Py3k feature, which suggests that
you should toss the whole string reliance and switch to unicode, as str
and unicode become bytes and text in Py3k, with bytes being mutable.
More information about the Python-Dev