[I18n-sig] initial python implementation of UCA available

M.-A. Lemburg mal at egenix.com
Fri Jan 27 15:48:10 CET 2006


James Tauber wrote:
> See http://jtauber.com/blog/2006/01/27/ 
> python_unicode_collation_algorithm
> 
> The core of the UCA is implemented and that's enough to do what I  
> currently need to do (sort Ancient Greek).
> 
> There's actually more code parsing the collation element table than  
> performing the actual sort key generation :-)
> 
> Let me know if you have any comments, suggestions, etc.

        for part in key:
            curr_node = curr_node[1].setdefault(part, [None, {}])

This could be made faster by not using .setdefault():
Python will still build the [None, {}] even if it's
not used.

In general, it's probably better to marshal the trie and
simply load the marshalled form on startup. That saves
you the setup time of having to build a trie from
a few thousand keys.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jan 27 2006)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the I18n-sig mailing list