Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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; 'encoded': 0.05; 'result,': 0.05; 'strings.': 0.07; '*is*': 0.09; '128': 0.09; 'effect.': 0.09; 'pep': 0.09; 'subject:string': 0.09; 'unicode,': 0.09; 'weak': 0.09; 'cc:addr:python-list': 0.10; 'aug': 0.13; '"code': 0.16; 'cp1252': 0.16; 'enough.': 0.16; 'example)': 0.16; 'mistake.': 0.16; 'subject:3.3': 0.16; 'unusable.': 0.16; '\xe9crit': 0.16; 'string': 0.17; 'wrote:': 0.17; 'byte': 0.17; 'bytes': 0.17; 'unicode': 0.17; '>>>': 0.18; 'trying': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'second': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'common': 0.26; 'ago': 0.27; 'am,': 0.27; 'coding': 0.27; 'converting': 0.27; 'correct': 0.28; 'chris': 0.28; 'accidentally': 0.29; 'character.': 0.29; 'lies': 0.29; 'scheme.': 0.29; 'character': 0.29; 'no,': 0.29; 'push': 0.30; 'basic': 0.30; 'sense': 0.31; 'code': 0.31; 'point': 0.31; 'european': 0.33; 'problem': 0.33; 'point.': 0.33; 'largest': 0.35; 'pm,': 0.35; 'but': 0.36; 'expensive': 0.36; 'should': 0.36; 'uses': 0.37; '(for': 0.37; 'subject:New': 0.37; 'rather': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'fact': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'your': 0.60; 'most': 0.61; 'side': 0.61; 'kind': 0.61; 'email addr:gmail.com': 0.63; 'more': 0.63; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; "it'd": 0.84; 'received:74.208.4.194': 0.84; 'effects.': 0.91 Date: Sun, 19 Aug 2012 08:29:17 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: wxjmfauth@gmail.com Subject: Re: New internal string format in 3.3 References: <308df2af-abe7-4043-b199-0a39f440e0ab@googlegroups.com> <502f8a2a$0$29978$c3e8da3$5496439d@news.astraweb.com> <4c62a649-bc21-4e47-9c0f-acb1b1e70e36@googlegroups.com> <5030891f$0$29978$c3e8da3$5496439d@news.astraweb.com> <5030aa44$0$29978$c3e8da3$5496439d@news.astraweb.com> <11931ec9-1858-4ae8-8a61-1d154d105229@googlegroups.com> <73c85f3b-a4a9-4812-bc41-132b5126874c@googlegroups.com> In-Reply-To: <73c85f3b-a4a9-4812-bc41-132b5126874c@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:BAZ21hwYAXDj1KoqXvEYozK0SUnYHGhofuHB8QPXc5t /cFWEtSRt09ebRpMQL2JGHD2pteLUV0dV/Bri56lQG7gUulZLJ Sk5mPJzYoJhqcyQqsr9rV6vJijmrrUnHhLzsqOfXwihThXLmJD gQIaHc8Rm+KIHJwWRGHdpQGkudPpLndQQPSZRe1aY/r05Xp+NF 6J6mSf+ONLKfV8Cvr6Tcoere6W6wtVEWePVUON/amZgQ4/RGSg 44G5dBnCtneB782VI4+gW5WAJihk9CJUAwqpnnCL7v11qjW0H4 gf4PrTdHSi5Wu3egL0i9Zq9FUoj5MLpp77FFC9o5lg9Ecuy3Q= = Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: d@davea.name 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345379387 news.xs4all.nl 6911 [2001:888:2000:d::a6]:36856 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27384 On 08/19/2012 08:14 AM, wxjmfauth@gmail.com wrote: > Le dimanche 19 août 2012 12:26:44 UTC+2, Chris Angelico a écrit : >> On Sun, Aug 19, 2012 at 8:19 PM, wrote: >> >>> This is precicely the weak point of this flexible >>> representation. It uses latin-1 and latin-1 is for >>> most users simply unusable. >> >> >> No, it uses Unicode, and as an optimization, attempts to store the >> >> codepoints in less than four bytes for most strings. The fact that a >> >> one-byte storage format happens to look like latin-1 is rather >> >> coincidental. >> > And this this is the common basic mistake. You do not push your > argumentation far enough. A character may "fall" accidentally in a latin-1. > The problem lies in these european characters, which can not fall in this > coding. This *is* the cause of the negative side effects. > If you are using a correct coding scheme, like cp1252, mac-roman or > iso-8859-15, you will never see such a negative side effect. > Again, the problem is not the result, the encoded character. The critical > part is the character which may cause this side effect. > You should think "character set" and not encoded "code point", considering > this kind of expression has a sense in 8-bits coding scheme. > > jmf But that choice was made decades ago when Unicode picked its second 128 characters. The internal form used in this PEP is simply the low-order byte of the Unicode code point. Trying to scan the string deciding if converting to cp1252 (for example) would be a much more expensive operation than seeing how many bytes it'd take for the largest code point. -- DaveA