Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'column': 0.07; 'detect': 0.07; 'postgresql': 0.07; 'utf-8': 0.07; 'string': 0.09; 'python': 0.11; 'anyway': 0.14; 'question.': 0.14; "wouldn't": 0.14; '*never*': 0.16; 'arbitrarily': 0.16; 'correctness.': 0.16; 'excluded': 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; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'roy': 0.16; 'thinking,': 0.16; 'throw': 0.16; 'unnecessary.': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'code.': 0.18; '(but': 0.19; '>>>': 0.22; 'code,': 0.22; 'input': 0.22; 'programming': 0.22; 'import': 0.22; '(in': 0.22; 'header:User-Agent:1': 0.23; 'replace': 0.24; 'mon,': 0.24; 'versions': 0.24; 'developers': 0.25; 'least': 0.26; 'subject:/': 0.26; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'character': 0.29; "doesn't": 0.30; 'newer': 0.30; 'that.': 0.31; "d'aprano": 0.31; 'go.': 0.31; 'so- called': 0.31; 'steven': 0.31; 'languages': 0.32; "we're": 0.32; 'entirely': 0.33; 'not.': 0.33; 'could': 0.34; 'problem': 0.35; 'received:84': 0.35; 'but': 0.35; 'there': 0.35; 'version': 0.36; 'leads': 0.36; 'processed': 0.36; 'done': 0.36; 'next': 0.36; 'url:org': 0.36; 'should': 0.36; 'sometimes': 0.38; 'version,': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'easy': 0.60; 'course': 0.61; "you're": 0.61; 'real': 0.63; 'maximum': 0.63; 'life': 0.66; 'worth': 0.66; 'header:Reply-To:1': 0.67; 'brain': 0.68; 'smith': 0.68; 'reply- to:no real name:2**0': 0.71; 'records': 0.73; 'million': 0.74; 'article': 0.77; '50%': 0.78; 'characters,': 0.84; 'reply- to:addr:python.org': 0.84; 'subject:long': 0.84; 'cutting': 0.91; 'hand,': 0.93; '2013': 0.98 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=HO4d4PRv c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=B68SgI_Jlq8A:10 a=8Th50HvhYqcA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=t8II4Uw-uu8A:10 a=RA7hJJdoAAAA:8 a=kZ7UWmmPAAAA:8 a=epTmVMiNAAAA:8 a=cP9uH6zpEC1kIOWBY0cA:9 a=wPNLvfGTeEIA:10 a=h_-tFkWMtyEA:10 a=pyH5b1fOeEsA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 X-AUTH: mrabarnett:2500 Date: Mon, 01 Apr 2013 18:53:44 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Performance of int/long in Python 3 References: <5153a12d$0$29998$c3e8da3$5496439d@news.astraweb.com> <5153d313$0$29984$c3e8da3$5496439d@news.astraweb.com> <0b6be19c-ff11-4e24-a7dc-fec0af411393@kw7g2000pbb.googlegroups.com> <5153f5ce$0$29984$c3e8da3$5496439d@news.astraweb.com> <11ef1d36-0783-4cb2-b29f-9ae573ed7e47@googlegroups.com> <6a146aba-a032-4aac-b2d3-7acedcebd804@q3g2000pbv.googlegroups.com> <515941d8$0$29967$c3e8da3$5496439d@news.astraweb.com> <5159beb6$0$29967$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <5159beb6$0$29967$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1364838821 news.xs4all.nl 6870 [2001:888:2000:d::a6]:42289 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:42475 On 01/04/2013 18:07, Steven D'Aprano wrote: > On Mon, 01 Apr 2013 08:15:53 -0400, Roy Smith wrote: > >> In article <515941d8$0$29967$c3e8da3$5496439d@news.astraweb.com>, >> Steven D'Aprano wrote: >> >>> [...] >>> >> OK, that leads to the next question. Is there anyway I can (in >>> >> Python 2.7) detect when a string is not entirely in the BMP? If I >>> >> could find all the non-BMP characters, I could replace them with >>> >> U+FFFD (REPLACEMENT CHARACTER) and life would be good (enough). >>> >>> Of course you can do this, but you should not. If your input data >>> includes character C, you should deal with character C and not just >>> throw it away unnecessarily. That would be rude, and in Python 3.3 it >>> should be unnecessary. >> >> The import job isn't done yet, but so far we've processed 116 million >> records and had to clean up four of them. I can live with that. >> Sometimes practicality trumps correctness. > > Well, true. It has to be said that few programming languages (and > databases) make it easy to do the right thing. On the other hand, you're > a programmer. Your job is to write correct code, not easy code. > > >> It turns out, the problem is that the version of MySQL we're using > > Well there you go. Why don't you use a real database? > > http://www.postgresql.org/docs/9.2/static/multibyte.html > > :-) > > Postgresql has supported non-broken UTF-8 since at least version 8.1. > > >> doesn't support non-BMP characters. Newer versions do (but you have to >> declare the column to use the utf8bm4 character set). I could upgrade >> to a newer MySQL version, but it's just not worth it. > > My brain just broke. So-called "UTF-8" in MySQL only includes up to a > maximum of three-byte characters. There has *never* been a time where > UTF-8 excluded four-byte characters. What were the developers thinking, > arbitrarily cutting out support for 50% of UTF-8? > [snip] 50%? The BMP is one of 17 planes, so wouldn't that be 94%?