to better observe locales

Alexander V. Voinov avv at quasar.ipa.nw.ru
Fri Jul 28 14:54:30 EDT 2000


Hi Python Author and Contributors,

I hope it's not too late to discuss this.

It seems that Python would better observe locales at almost no cost.

1. list.sort(). If the sorted list is just a list of strings, it's
trivial to pass 'strcoll' as an argument. But if the list element is a
tuple, I have to write my own comparison function which would use
locale.

2. Those '\xxx\yyy\zzz' in the string literals, emitted by 'repr'. It
would be a good idea not to encode that way those letters, which are
claimed as letters by the locale.

The default locale is easily read from the environment both on Unices
and on win32. No idea about the rest of the world. Therefore, if the
locale, read from the environment, is not 'en', one may just apply its
rules immediately upon interpreter startup (for the two mentioned
issues, and maybe some others: use strcoll instead of strcmp _everywhere
internally_, use letter ranges, defined by the locale, etc). Otherwise
the current Python supprt of locales would really have no practical use,
even mislead those who believe that support to exist.

Thank you in advance

Alexander




More information about the Python-list mailing list