[Python-Dev] [1.6]: UserList, Dict: Do we need a UserString class? (original) (raw)

Andy Robinson andy@reportlab.com
Tue, 28 Mar 2000 18:13:02 GMT


On Mon, 27 Mar 2000 12:00:31 -0500 (EST), Peter Funk wrote:

Do we need a UserString class?

This will probably be useful on top of the i18n stuff in due course, so I'd like it.

Something Mike Da Silva and I have discussed a lot is implementing a higher-level 'typed string' library on top of the Unicode stuff. =20 A 'typed string' is like a string, but knows what encoding it is in - possibly Unicode, possibly a native encoding and embodies some basic type safety and convenience notions, like not being able to add a Shift-JIS and an EUC string together. Iteration would always be per character, not per byte; and a certain amount of magic would say that if the string was (say) Japanese, it would acquire a few extra methods for doing some Japan-specific things like expanding half-width katakana.

Of course, we can do this anyway, but I think defining the API clearly in UserString is a great idea.