Allowing non-ASCII identifiers (Fran?ois Pinard)

François Pinard pinard at iro.umontreal.ca
Mon Feb 9 16:14:17 EST 2004


[Paul Prescod]

> I wonder if the proposal would be more palatable if it were restricted
> to 8-bit encodings (what we used to call "code pages").  This is at
> least a first step in the right direction that would help westerners
> and could be made to work even if Python were compiled without Unicode
> support.

To repeat something I was writing to python-dev earlier today, it
already works by some kind of accident.  A smallish main program
could do:

    import locale
    locale.setlocale(locale.LC_ALL, '')
    import THE-REAL-APPLICATION

to activate your code page, given your environment is already set for
it.  This will activate proper classification of characters in <ctype.c>
and then, Python seems to behave properly with non-ASCII identifiers
within the imported application.

It is an accident because it was not meant this way by Guido, at least
so far that I know.  The trick might break at various places, who knows.
I did not test it seriously, and do not intend to rely on it, as Guido
might even choose to consider this as a bug to be corrected.

The plan rather seems to be to support non-ASCII identifiers widely
instead of parsimoniously, if Python ever does it, or not at all.  The
decision has not been taken yet, Guido wants a PEP and a discussion
first.

In my experience, such discussions are often rough (or at least
demanding), because people have a lot of emotions on linguistic
issues, and do not always show the real relations between emotions and
rationalisations, which sometimes get convoluted.

> (it is still possible to compile Python without Unicode isn't it?)

I would guess that Unicode in Python is central if you want codecs to
work, in particular for all code pages which Python currently supports.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard




More information about the Python-list mailing list