Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'read.': 0.03; 'encoding': 0.05; 'referring': 0.07; 'utf-8': 0.07; 'string': 0.09; 'bits': 0.09; 'character,': 0.09; 'encode': 0.09; 'parsing': 0.09; 'python': 0.11; 'character.': 0.16; 'codec': 0.16; 'wrote:': 0.18; 'looked': 0.18; 'implementing': 0.19; 'thu,': 0.19; '(the': 0.22; 'bytes': 0.24; 'decide': 0.24; '(or': 0.24; 'header:In-Reply- To:1': 0.27; 'point': 0.28; 'character': 0.29; 'points': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '25,': 0.31; 'contrast,': 0.31; "d'aprano": 0.31; 'header,': 0.31; 'steven': 0.31; 'text': 0.33; "can't": 0.35; 'anybody': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'sequence': 0.36; 'being': 0.38; 'basis.': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'tell': 0.60; 'different': 0.65; 'further,': 0.74; 'jul': 0.74; 'examining': 0.84; 'points,': 0.84; '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:from:date:message-id:subject:to :content-type; bh=i+fvhIyS5CT1Zz87I350R6Xed1WQWAc+EzsFzgaqV+Y=; b=1KR0kheEZsYq4VLQec7s/7jymiZVjPggRdSGL7uL5XRebMJhJiRJ/EyDwrQcIrF4W1 3cX4OMxy6TCrr7lRpZU/cpDic6SdfeyqcIGJXNBEHtZU/qVkNkuHl8BRKeAhGvtJBFpF Qfax8oRKOwcxXX1TiiN9tYfOypCITJUNPpaPK/APuD+fGRYbibfww+kTVPOSpqnsO2PH 6yapOxPdHQ3+A+jwIZn5gJLsRNvNO+9exoJovK6ICkqQX1ewPsaIX1wfytWMofEAwkI6 9ipY3WePqrvc0Bmh0zkFbbeRL4TNLv5IDO9OU6KDZo9m3WosPJQ3h/ATV7fcl3p5PJ35 SF8Q== X-Received: by 10.68.164.225 with SMTP id yt1mr50477822pbb.195.1374808885589; Thu, 25 Jul 2013 20:21:25 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <51f1e371$0$29971$c3e8da3$5496439d@news.astraweb.com> 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> <51f1e371$0$29971$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Thu, 25 Jul 2013 21:20:45 -0600 Subject: Re: RE Module Performance To: Python 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1374808894 news.xs4all.nl 15869 [2001:888:2000:d::a6]:43178 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:51277 On Thu, Jul 25, 2013 at 8:48 PM, Steven D'Aprano wrote: > UTF-8 uses a flexible representation on a character-by-character basis. > When parsing UTF-8, one needs to look at EVERY character to decide how > many bytes you need to read. In Python 3, the flexible representation is > on a string-by-string basis: once Python has looked at the string header, > it can tell whether the *entire* string takes 1, 2 or 4 bytes per > character, and the string is then fixed-width. You can't do that with > UTF-8. UTF-8 does not use a flexible representation. A codec that is encoding a string in UTF-8 and examining a particular character does not have any choice of how to encode that character; there is exactly one sequence of bits that is the UTF-8 encoding for the character. Further, for any given sequence of code points there is exactly one sequence of bytes that is the UTF-8 encoding of those code points. In contrast, with the FSR there are as many as three different sequences of bytes that encode a sequence of code points, with one of them (the shortest) being canonical. That's what makes it flexible. Anyway, my point was just that Emacs is not a counter-example to jmf's claim about implementing text editors, because UTF-8 is not what he (or anybody else) is referring to when speaking of the FSR or "something like the FSR".