Josiah Carlson wrote:
Fredrik Lundh email@example.com wrote:
Ron Adam wrote:
I think what may be missing is a larger set of higher level string functions that will work with lists of strings directly. Then lists of strings can be thought of as a mutable string type by its use, and then working with substrings in lists and using ''.join() will not seem as out of place.
as important is the observation that you don't necessarily have to join string lists; if the data ends up being sent over a wire or written to disk, you might as well skip the join step, and work directly from the list.
(it's no accident that ET has grown "tostringlist" and "fromstringlist" functions, for example ;-)
I've personally added a line-based abstraction with indent/dedent handling, etc., for the editor I use, which helps make macros and underlying editor functionality easier to write.
I've done the same thing just last week. I've started to collect them into a module called stringtools, but I see no reason why they can't reside in the string module.
I think this may be just a case of collecting these type of routines together in one place so they can be reused easily because they already are scattered around pythons library in some form or another.
Another tool I found tucked away within a pydoc is the console pager that is used in pydoc. I think it could easily be a separate module it self. And it benefits from the line-based abstraction as well.