Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'ascii': 0.07; 'bits': 0.07; 'bytes.': 0.07; 'python': 0.09; 'destroyed.': 0.09; 'subject:string': 0.09; ':-)': 0.13; '(code': 0.16; '50)': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'subject:unicode': 0.16; 'wrote:': 0.17; 'bytes': 0.17; '>>>': 0.18; 'example': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'lines': 0.28; '>>>>': 0.29; 'received:192.168.1.3': 0.29; 'character': 0.29; 'switch': 0.32; 'to:addr:python-list': 0.33; 'add': 0.36; 'optimization': 0.37; 'subject:: ': 0.38; 'page': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:, ': 0.61; 'containing': 0.61; 'between': 0.63; 'subject:...': 0.63; 'charset:windows-1252': 0.65; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'neil': 0.84; 'reply-to:addr:python.org': 0.84; 'shrinking': 0.84; 'subject:, ...': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=W6e6pGqk c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=DKcI9XZsuF4A:10 a=DrpCnYH1euwA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=N659UExz7-8A:10 a=6UVWg15CXDMA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=pGLkceISAAAA:8 a=C-teBxVXhI6cpXHNikcA:9 a=pILNOxqGKmIA:10 a=MSl-tDqOz04A:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 X-AUTH: mrabarnett:2500 Date: Thu, 23 Aug 2012 16:11:05 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Flexible string representation, unicode, typography, ... References: 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.12 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345734660 news.xs4all.nl 6886 [2001:888:2000:d::a6]:41686 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27740 On 23/08/2012 14:57, Neil Hodgson wrote: > wxjmfauth@gmail.com: > >> Small illustration. Take an a4 page containing 50 lines of 80 ascii >> characters, add a single 'EM DASH' or an 'BULLET' (code points> 0x2000), >> and you will see all the optimization efforts destroyed. >> >>>> sys.getsizeof('a' * 80 * 50) >> 4025 >>>>> sys.getsizeof('a' * 80 * 50 + '•') >> 8040 > > This example is still benefiting from shrinking the number of bytes > in half over using 32 bits per character as was the case with Python 3.2: > > >>> sys.getsizeof('a' * 80 * 50) > 16032 > >>> sys.getsizeof('a' * 80 * 50 + '•') > 16036 > >>> > Perhaps the solution should've been to just switch between 2/4 bytes instead of 1/2/4 bytes. :-)