Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'indexing': 0.07; 'responding': 0.07; 'string': 0.09; '32-bit': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'do!': 0.16; 'encodings': 0.16; 'opposite': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'specific,': 0.16; "tim's": 0.16; 'width.': 0.16; 'ignore': 0.16; 'wrote:': 0.18; 'pointed': 0.19; "python's": 0.19; "skip:' 30": 0.19; '>>>': 0.22; 'header :User-Agent:1': 0.23; 'him.': 0.24; "shouldn't": 0.24; 'posts': 0.26; 'post': 0.26; 'header:X-Complaints-To:1': 0.27; 'am,': 0.29; 'tim': 0.29; "doesn't": 0.30; 'gives': 0.31; 'chase': 0.31; 'subject:size': 0.31; '(e.g.': 0.33; 'agree': 0.35; 'charset:us- ascii': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'space': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'up,': 0.60; 'full': 0.61; 'matter': 0.61; 'debate': 0.68; 'topics.': 0.68; 'saving': 0.69; 'opinions': 0.70; 'engage': 0.74; 'air,': 0.84; 'batchelder': 0.84; 'dominant': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Neil Cerutti Subject: Re: Finding size of Variable Date: Tue, 11 Feb 2014 14:29:22 +0000 (UTC) Organization: Norwich University References: <8e4c1ab1-e65d-483f-ad9d-6933ae2052c3@googlegroups.com> <7e7d3200-a4ae-4842-ad8d-68b4435b9006@googlegroups.com> <52f219c5$0$29972$c3e8da3$5496439d@news.astraweb.com> <888bd2fc-54b0-4c46-9d7b-d81d01a78b52@googlegroups.com> <52f59aeb$0$29972$c3e8da3$5496439d@news.astraweb.com> <20140210084308.7727c0fd@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: jackman.norwich.edu User-Agent: slrn/0.9.9p1/mm/ao (Win32) 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: 1392128988 news.xs4all.nl 2951 [2001:888:2000:d::a6]:33338 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65910 On 2014-02-10, Ned Batchelder wrote: > On 2/10/14 9:43 AM, Tim Chase wrote: >>> The opposite of what the utf8/utf16 do! >>> >>>>>> sys.getsizeof(('a' * 1000000 + 'oe' + >>>>>> '\U00010000').encode('utf-8')) >>> 1000023 >>>>>> sys.getsizeof(('a' * 1000000 + 'oe' + >>>>>> '\U00010000').encode('utf-16')) >>> 2000025 >> >> However, as pointed out repeatedly, string-indexing in >> fixed-width encodings are O(1) while indexing into >> variable-width encodings (e.g. UTF8/UTF16) are O(N). The FSR >> gives the benefits of O(1) indexing while saving space when a >> string doesn't need to use a full 32-bit width. > > Please don't engage in this debate with JMF. His mind is made > up, and he will not be swayed, no matter how persuasive and > reasonable your arguments. Just ignore him. I think reasonable criticisms should be contested no matter who posts them. I agree jmf shouldn't be singled out for abuse, summoned, insulted, or have his few controversial opinions brought into other topics. Tim's post was responding to a specific, well-presented criticism of Python's string implementation. Left unchallenged, it might linger unhappily in the air, like a symphony ended on a dominant 7th chord. -- Neil Cerutti