Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:134': 0.05; 'python': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:k 40': 0.09; 'subject:string': 0.09; '3.2.': 0.16; 'instead:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'rewriting': 0.16; 'subject:unicode': 0.16; 'wrote:': 0.17; 'example': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; '20%': 0.29; 'to:addr:python-list': 0.33; 'there': 0.35; 'received:org': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'subject:, ': 0.61; 'subject:...': 0.63; 'otten': 0.84; 'subject:, ...': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Serhiy Storchaka Subject: Re: Flexible string representation, unicode, typography, ... Date: Sun, 02 Sep 2012 15:00:59 +0300 References: <503a0d51$0$6574$c3e8da3$5496439d@news.astraweb.com> <503a8361$0$6574$c3e8da3$5496439d@news.astraweb.com> <2e92da71-fbd2-467f-9088-1c79fa7bcf69@googlegroups.com> <62566024-df1d-4948-a27a-45c7820ddc6c@googlegroups.com> <503f0e45$0$9416$c3e8da3$76491128@news.astraweb.com> <2a12ba52-232a-41b7-a906-1ec379bbddd7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 134.249.6.6 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346587277 news.xs4all.nl 6891 [2001:888:2000:d::a6]:47380 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28267 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.