On Sun, Sep 2, 2012 at 6:00 AM, Serhiy Storchaka <storch...@gmail.com> wrote: > On 02.09.12 12:52, Peter Otten wrote: >> >> Ian Kelly wrote: >> >>> Rewriting the example to use locale.strcoll instead: >> >> >>>>>> sorted(li, key=functools.cmp_to_key(locale.strcoll)) >> >> >> There is also locale.strxfrm() which you can use directly: >> >> sorted(li, key=locale.strxfrm) > > > Hmm, and with locale.strxfrm Python 3.3 20% slower than 3.2.
Doh! In Python 3.3, strcoll and strxfrm are the same speed, so I guess that the actual optimization I'm seeing here is that in Python 3.3, cmp_to_key(strcoll) has been optimized to return strxfrm. -- http://mail.python.org/mailman/listinfo/python-list