Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.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; 'python)': 0.05; 'ascii': 0.07; 'bits': 0.07; 'currency': 0.07; 'python': 0.09; 'correct,': 0.09; 'destroyed.': 0.09; 'happen?': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; 'sure,': 0.09; 'unicode,': 0.09; 'url:unicode': 0.09; 'url:)': 0.13; 'cases': 0.15; '(code': 0.16; '50)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'stuff,': 0.16; 'subject:unicode': 0.16; 'symbols,': 0.16; 'unicode?': 0.16; 'valid.': 0.16; '\xe9crit': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'mathematical': 0.17; 'unicode': 0.17; '>>>': 0.18; 'example': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'appear': 0.26; 'propose': 0.27; 'header:X-Complaints-To:1': 0.28; 'lines': 0.28; 'case,': 0.29; 'character': 0.29; "i'm": 0.29; 'code': 0.31; 'point': 0.31; 'from:addr:yahoo.co.uk': 0.32; 'instead,': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'nature': 0.35; 'add': 0.36; 'received:org': 0.36; 'but': 0.36; 'url:org': 0.36; 'characters': 0.36; 'should': 0.36; 'possible': 0.37; 'optimization': 0.37; 'does': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'page': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'range': 0.60; 'subject:, ': 0.61; 'containing': 0.61; 'here:': 0.62; 'expert': 0.62; 'solve': 0.62; 'subject:...': 0.63; 'times': 0.63; 'email addr:gmail.com': 0.63; 'french': 0.64; 'charset:windows-1252': 0.65; 'due': 0.66; 'algorithm,': 0.84; 'neil': 0.84; 'optimize,': 0.84; 'shrinking': 0.84; 'subject:, ...': 0.84; 'valid,': 0.84; 'received:2': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Flexible string representation, unicode, typography, ... Date: Thu, 23 Aug 2012 20:34:29 +0100 References: <7eaafbcd-597d-4f8c-98a8-ecb537e6e065@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-2-98-202-33.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <7eaafbcd-597d-4f8c-98a8-ecb537e6e065@googlegroups.com> X-Antivirus: avast! (VPS 120823-0, 23/08/2012), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 73 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345750334 news.xs4all.nl 6896 [2001:888:2000:d::a6]:59642 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27763 On 23/08/2012 19:33, wxjmfauth@gmail.com wrote: > Le jeudi 23 août 2012 15:57:50 UTC+2, Neil Hodgson a écrit : >> 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 >> > Correct, but how many times does it happen? > Practically never. > > In this unicode stuff, I'm fascinated by the obsession > to solve a problem which is, due to the nature of > Unicode, unsolvable. > > For every optimization algorithm, for every code > point range you can optimize, it is always possible > to find a case breaking that optimization. > > This follows quasi the mathematical logic. To proof a > law is valid, you have to proof all the cases > are valid. To proof a law is invalid, just find one > case showing it. > > Sure, it is possible to optimize the unicode usage > by not using French characters, punctuation, mathematical > symbols, currency symbols, CJK characters... > (select undesired characters here: http://www.unicode.org/charts/). > > In that case, why using unicode? > (A problematic not specific to Python) > > jmf > What do you propose should be used instead, as you appear to be the resident expert in the field? -- Cheers. Mark Lawrence.