On 3 June 2011 07:17, Martin Pool <m...@canonical.com> wrote:
[...]
> Maybe as a simple place to start there should just be a "compare human
> strings" function that can be passed to sort(cmp=) and at least the
> .lower() will not be repeated.
[...]
> Maybe we should actually use locale.strcoll, rather than comparing the
> lowered forms?  <http://docs.python.org/library/locale.html>  istr
> this is rather better on non-English names.  For en_AU.UTF-8  it is
> case insensitive, though it is case sensitive in C.

Fwiw, the cmp argument to list.sort() and sorted() is deprecated, and
is gone in Python 3. However, I think strxfrm() can be used instead of
strcoll(), i.e. sorted(names, key=locale.strxfrm)

_______________________________________________
Mailing list: https://launchpad.net/~launchpad-dev
Post to     : launchpad-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~launchpad-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to