Benefits of unicode identifiers

Marko Rauhamaa marko at pacujo.net
Fri Nov 24 07:48:05 EST 2017


bartc <bc at freeuk.com>:

> On 24/11/2017 11:56, Stefan Ram wrote:
>>    Java allowed Unicode in identifiers right from the get-go
>>    (1995). I.e., one can write an assignment statement such as
>>
>> π = 3.141;
>
> That's great. But how do I type it on my keyboard? How do I view someone
> else's code on my crappy ASCII text editor?

That's a different problem entirely.

I remember the 1980's when terminals only supported 7-bit characters,
but Finnish people needed to be able to type Finnish text. The solution
was to ditch unneeded American punctuation characters. Thus, your
first-ever C-program might have looked like this:

    main(argc, argv)
    int argc;
    char argvÄÅ;
    ä
        printf("Hello, world!Ön");
    å

> German isn't very challenging apart from a couple of umlauts and that
> funny symbol for ss that looks like a Greek beta. And perhaps in
> Germany, keyboards will already take care of those.
>
> But which keyboards will have π [copied from the one above!]?

I can map any character onto any key. In fact, my keyboard mapping is
heavily personalized.

I must admit, though, that I haven't mapped π onto any key.


It would be naïve to assume, though, that the problem doesn't apply to
English. You never had to type a résumé—or use non-ASCII punctuation? If
you should stray out of the USA, it wouldn't hurt to carry some € or £. I
*have* mapped those keys onto my keyboard.


Marko



More information about the Python-list mailing list