Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'indexing': 0.07; 'referring': 0.07; 'sys': 0.07; 'excluding': 0.09; 'feature,': 0.09; 'fix.': 0.09; 'fixed,': 0.09; 'mind,': 0.09; 'pep': 0.09; 'wrapper': 0.09; 'bug': 0.12; 'language,': 0.12; 'detects': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'objections': 0.16; 'presume': 0.16; 'reedy': 0.16; 'language': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'platforms': 0.22; '(in': 0.22; 'byte': 0.24; 'people,': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'feature': 0.29; 'am,': 0.29; 'array': 0.29; 'character': 0.29; 'possibility': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'easier': 0.31; '25,': 0.31; 'anyone': 0.31; 'critical': 0.32; 'except': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'should': 0.36; 'application': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'according': 0.40; 'how': 0.40; 'new': 0.61; 'here': 0.66; 'jul': 0.74; 'expose': 0.84; 'optimized,': 0.84; 'exposing': 0.91; 'url:mozilla': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=aySWwXVZEKveCBuyMU7zRJukFgm3IfBqcjaQXtBFF1A=; b=iMo3KAwYpCCWfJ3kbnKp0L+u30EbT9tuGcbv1i5h8dNuENFBp5zkPnO1DMk0wqr/4u hrS1KvNjukyk2CfEVmEFAdcFdLKcXj6V4dED2aXBGdeQPgZtCrM6ulhpzKVNuNUFjAtM ICu95QhTDlu/Qez+srliHQFDHtdL0coSHe1PG2VqZdPc8LILV+KO0klUJ9uizYChOIYB 0SuMDs12+B4IOwLcSShC7yhQftYbfRAZZOA0v9ZlgspB/VSLOYcasPzEwjoCuN+B3Cfl AuxT8VQacDw61Ovy2/KdTf6DTZ4CxCTYyFCxYuepi/COsDrisfHaRfWBumZ+w/HqRIgY yccw== MIME-Version: 1.0 X-Received: by 10.52.34.40 with SMTP id w8mr13362840vdi.7.1374704362036; Wed, 24 Jul 2013 15:19:22 -0700 (PDT) In-Reply-To: References: <571a6dfe-fd66-42cf-92fc-8b97cbe6e9e4@googlegroups.com> <51DFDE65.5040001@Gmail.com> <4f1067f6-bc99-42ad-9166-37fb228b90e8@googlegroups.com> <51EFEC17.90303@gmail.com> Date: Thu, 25 Jul 2013 08:19:21 +1000 Subject: Re: RE Module Performance From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374704365 news.xs4all.nl 15957 [2001:888:2000:d::a6]:43017 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51171 On Thu, Jul 25, 2013 at 8:09 AM, Terry Reedy wrote: > On 7/24/2013 2:15 PM, Chris Angelico wrote: >> To my mind, exposing UTF-16 surrogates to the application is a bug >> to be fixed, not a feature to be maintained. > > It is definitely not a feature, but a proper UTF-16 implementation would not > expose them except to codecs, just as with the PEP 393 implementation. (In > both cases, I am excluding the sys size function as 'exposing to the > application'.) > >> But since we can get the best of both worlds with only >> a small amount of overhead, I really don't see why anyone should be >> objecting. > > I presume you are referring to the PEP 393 1-2-4 byte implementation. Given > how well it has been optimized, I think it was the right choice for Python. > But a language that now uses USC2 or defective UTF-16 on all platforms might > find the auxiliary array an easier fix. > I'm referring here to objections like jmf's, and also to threads like this: http://mozilla.6506.n7.nabble.com/Flexible-String-Representation-full-Unicode-for-ES6-td267585.html According to the ECMAScript people, UTF-16 and exposing surrogates to the application is a critical feature to be maintained. I disagree. But it's not my language, so I'm stuck with it. (I ended up writing a little wrapper function in C that detects unpaired surrogates, but that still doesn't deal with the possibility that character indexing can create a new character that was never there to start with.) ChrisA