Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!news.skynet.be!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'memory.': 0.07; 'problem:': 0.07; '(those': 0.09; 'ascii': 0.09; 'bits': 0.09; 'escape': 0.09; 'lost.': 0.09; 'python': 0.11; 'stored': 0.12; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'non-ascii': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:unicode': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'mechanism': 0.19; 'seems': 0.21; '8bit%:5': 0.22; 'coding': 0.22; 'header:User-Agent:1': 0.23; 'char': 0.24; 'unicode': 0.24; 'compare': 0.26; 'header:In-Reply-To:1': 0.27; 'feature': 0.29; "doesn't": 0.30; 'characters': 0.30; 'code': 0.31; "skip:' 10": 0.31; '3.2': 0.31; '>>>>': 0.31; 'this.': 0.32; "can't": 0.35; 'received:84': 0.35; 'handle': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'tell': 0.60; 'skip:* 10': 0.61; 'email addr:gmail.com': 0.63; 'soon': 0.63; 'therefore,': 0.64; 'more': 0.64; '(that': 0.65; 'charset:windows-1252': 0.65; 'header:Reply-To:1': 0.67; 'reply- to:no real name:2**0': 0.71; 'secret': 0.74; 'goal': 0.75; 'reply- to:addr:python.org': 0.84; 'secret.': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=RZapVTdv c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=K2DDQYBT4xIA:10 a=Euh8oaAuAMwA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=N659UExz7-8A:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=Ng6QQHMrQjUA:10 a=pGLkceISAAAA:8 a=5aZOK4Y0j2zBx5cwfgEA:9 a=LWzW7A4xSNp-yWED:21 a=MXe6wCchsQAncq2w:21 a=pILNOxqGKmIA:10 a=MSl-tDqOz04A:10 X-AUTH: mrabarnett:2500 Date: Sun, 28 Jul 2013 20:44:17 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: python-list@python.org Subject: Re: FSR and unicode compliance - was Re: RE Module Performance References: <571a6dfe-fd66-42cf-92fc-8b97cbe6e9e4@googlegroups.com> <51DFDE65.5040001@Gmail.com> <4f1067f6-bc99-42ad-9166-37fb228b90e8@googlegroups.com> <51f14395$0$29971$c3e8da3$5496439d@news.astraweb.com> <51f15e03$0$29971$c3e8da3$5496439d@news.astraweb.com> <8203e802-9dc5-44c5-9547-6e1947ee224b@googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org 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: 62 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1375040663 news.xs4all.nl 15895 [2001:888:2000:d::a6]:38158 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51403 On 28/07/2013 20:23, wxjmfauth@gmail.com wrote: [snip] > > Compare these (a BDFL exemple, where I'using a non-ascii char) > > Py 3.2 (narrow build) > Why are you using a narrow build of Python 3.2? It doesn't treat all codepoints equally (those outside the BMP can't be stored in one code unit) and, therefore, it isn't "Unicode compliant"! >>>> timeit.timeit("a = 'hundred'; 'x' in a") > 0.09897159682121348 >>>> timeit.timeit("a = 'hundre€'; 'x' in a") > 0.09079501961732461 >>>> sys.getsizeof('d') > 32 >>>> sys.getsizeof('€') > 32 >>>> sys.getsizeof('dd') > 34 >>>> sys.getsizeof('d€') > 34 > > > Py3.3 > >>>> timeit.timeit("a = 'hundred'; 'x' in a") > 0.12183182740848858 >>>> timeit.timeit("a = 'hundre€'; 'x' in a") > 0.2365732969632326 >>>> sys.getsizeof('d') > 26 >>>> sys.getsizeof('€') > 40 >>>> sys.getsizeof('dd') > 27 >>>> sys.getsizeof('d€') > 42 > > Tell me which one seems to be more "unicode compliant"? > The goal of Unicode is to handle every char "equaly". > > Now, the problem: memory. Do not forget that à la "FSR" > mechanism for a non-ascii user is *irrelevant*. As > soon as one uses one single non-ascii, your ascii feature > is lost. (That why we have all these dedicated coding > schemes, utfs included). > >>>> sys.getsizeof('abc' * 1000 + 'z') > 3026 >>>> sys.getsizeof('abc' * 1000 + '\U00010010') > 12044 > > A bit secret. The larger a repertoire of characters > is, the more bits you needs. > Secret #2. You can not escape from this. > > > jmf >