[Python-3000] Making more effective use of slice objects in Py3k (original) (raw)
Guido van Rossum guido at python.org
Thu Aug 31 05:05:26 CEST 2006
- Previous message: [Python-3000] Making more effective use of slice objects in Py3k
- Next message: [Python-3000] Making more effective use of slice objects in Py3k
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 8/30/06, Talin <talin at acm.org> wrote:
I know this was shot down before, but I would still like to see a "characters" type - that is, a mutable sequence of wide characters, much like the Java StringBuffer class - to go along with "bytes". From my perspective, it makes perfect sense to have an "array of character" type as well as an "array of byte" type, and since the "array of byte" is simply called "bytes", then by extension the "array of character" type would be called "characters".
Of course, both the 'array' and 'list' types already give you that, but "characters" would have additional string-like methods. (However since it is mutable, it would not be capable of producing views.) The 'characters' data type would be particularly optimized for character-at-a-time operations, i.e. building up a string one character at a time. An example use would be processing escape sequences in strings, where you are transforming the escaped string into its non-escaped equivalent.
The array module was always usable for this purpose (even for Unicode characters) but it doesn't seem to have gotten any traction. So it sounds like a YAGNI to me.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-3000] Making more effective use of slice objects in Py3k
- Next message: [Python-3000] Making more effective use of slice objects in Py3k
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]