Flexible string representation, unicode, typography, ...

Dan Sommers dan at tombstonezero.net
Sun Aug 26 16:45:09 EDT 2012


On 2012-08-26 at 20:13:21 +0000,
Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:

> I note that not all 32-bit ints are valid code points. I suppose I can
> see sense in having rune be a 32-bit integer value limited to those
> valid code points. (But, dammit, why not call it a code point?) But if
> rune is merely an alias for int32, why not just call it int32?

Having a "code point" type is a good idea.  If nothing else, human code
readers can tell that you're doing something with characters rather than
something with integers.  If your language provides any sort of type
safety, then you get that, too.

Calling your code points int32 is a bad idea for the same reason that it
turned out to be a bad idea to call all my old ASCII characters int8.
Or all my pointers int<n> (or unsigned int<n>), for n in 16, 20, 24, 32,
36, 48, or 64 (or I'm sure other values of n that I never had the pain
or pleasure of using).

Dan



More information about the Python-list mailing list