This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tchrist
Recipients Arfrever, belopolsky, daniel.urban, eric.araujo, ezio.melotti, gvanrossum, mrabarnett, rhettinger, tchrist
Date 2011-08-26.22:21:08
SpamBayes Score 2.6856085e-07
Marked as misclassified No
Message-id <5347.1314397261@chthon>
In-reply-to <1314396042.37.0.820991766424.issue12735@psf.upfronthosting.co.za>
Content
Raymond Hettinger <raymond.hettinger@gmail.com> added the comment:

> I would like to be involved in the design of the API for a UCA module
> and its routines for loading Unicode Collation Element Tables (not
> making the mistake of using global state like the locale module does).

Is this the problem where a locale is global to a process (or thread)?

The way I'm used to using the UCA module in Perl, that's never a problem,
because it's completely object-oriented.  There's no global state.  You 
instantiate a collator object with all the state it needs, like

    collation_level
    upper_before_lower
    backwards_levels
    normalization
    override_CJK
    override_Hangul
    katakana_before_hiragana
    variable
    locale
    preprocess

And then you use that object for all your collation needs, including
not just sorting but also string comparison and even searches.

For example, you could instantiate a first collator object with its level
set to one, meaning just compare base alphanumerics not diacritics or case
or nonletters, and a second with the defaults so that it uses all four
levels or a different normalization.  I have on occasion had more than one
collator object around at once each with its own locale, like if I want to
compare different locales' comparisons.

--tom
History
Date User Action Args
2011-08-26 22:21:09tchristsetrecipients: + tchrist, gvanrossum, rhettinger, belopolsky, ezio.melotti, eric.araujo, mrabarnett, Arfrever, daniel.urban
2011-08-26 22:21:08tchristlinkissue12735 messages
2011-08-26 22:21:08tchristcreate