Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; ';-)': 0.03; 'algorithm': 0.04; 'encoding': 0.05; 'tree': 0.05; 'subject:Python': 0.06; 'incompatible': 0.07; 'indexing': 0.07; 'scaling': 0.07; 'subject: -- ': 0.07; 'utf-8': 0.07; 'string': 0.09; 'bits': 0.09; 'character,': 0.09; 'cc:addr:python-list': 0.11; 'thread': 0.14; '-tkc': 0.16; 'character.': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'happy,': 0.16; 'internally': 0.16; 'iterating': 0.16; 'operation,': 0.16; 'operation.': 0.16; 'wider': 0.16; 'wrote:': 0.18; '(where': 0.19; 'fit': 0.20; 'memory': 0.22; 'cc:addr:python.org': 0.22; 'bytes': 0.24; 'paul': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; '(see': 0.26; 'header:In-Reply-To:1': 0.27; 'thus': 0.29; 'characters': 0.30; "d'aprano": 0.31; 'steven': 0.31; 'subject:skip:i 10': 0.31; 'writes:': 0.31; 'allows': 0.31; 'maybe': 0.34; 'could': 0.34; 'but': 0.35; 'there': 0.35; 'returning': 0.36; 'charset:us-ascii': 0.36; 'skip:o 20': 0.38; 'that,': 0.38; 'even': 0.60; 'different': 0.65; 'world': 0.66; 'side': 0.67; 'eight': 0.74; 'walk': 0.74; 'balanced': 0.84; 'complexity': 0.84; 'everything,': 0.84; 'everything.': 0.84; 'received:50.22': 0.84; 'navigate': 0.91; 'russia': 0.91 Date: Wed, 4 Jun 2014 06:01:52 -0500 From: Tim Chase To: Paul Rubin Subject: Re: Micro Python -- a lean and efficient implementation of Python 3 In-Reply-To: <7xoay9w1h0.fsf@ruckus.brouhaha.com> References: <20140603194949.3147497d@x34f> <44acd692-5dcd-4e5f-8238-7fbe0de4db2a@googlegroups.com> <538ecdef$0$11109$c3e8da3@news.astraweb.com> <7xoay9w1h0.fsf@ruckus.brouhaha.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Get-Message-Sender-Via: boston.accountservergroup.com: authenticated_id: tim@thechases.com Cc: python-list@python.org 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: 1401879750 news.xs4all.nl 2914 [2001:888:2000:d::a6]:36347 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72626 On 2014-06-04 00:58, Paul Rubin wrote: > Steven D'Aprano writes: > >> Maybe there's a use-case for a microcontroller that works in > >> ISO-8859-5 natively, thus using only eight bits per character, > > That won't even make the Russians happy, since in Russia there > > are multiple incompatible legacy encodings. > > I've never understood why not use UTF-8 for everything. If you use UTF-8 for everything, then you end up in a world where string-indexing (see ChrisA's other side thread on this topic) is no longer an O(1) operation, but an O(N) operation. Some of us slice strings for a living. ;-) I understand that using UTF-32 would allow us to maintain O(1) indexing at the cost of every string occupying 4 bytes per character. The FSR (again, as I understand it) allows strings that fit in one-byte-per-character to use that, scaling up to use wider characters internally as they're actually needed/used. At the cost of complexity and non-constant memory space, an O(N) algorithm could be tweaked down to O(log N) by using an internal balanced tree of offsets-to-chunks (where the chunk-size was the size of a block where it was faster to scan linearly than to navigate the tree). One might even endow the algorithm with FSR smarts, so each chunk/fragment could be a different encoding in memory, and linearly iterating over the string would walk the tree, returning each decoded piece. -tkc