Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.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; 'subject:not': 0.03; 'subject:Python': 0.06; '*not*': 0.07; 'odd': 0.07; 'variables': 0.07; 'filename': 0.09; 'lawrence': 0.09; 'sucks': 0.09; 'python': 0.11; 'bug': 0.12; "wouldn't": 0.14; 'posted': 0.15; "'-'": 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; 'objects.': 0.16; 'received:192.168.1.4': 0.16; 'simplified': 0.16; 'subject:Unicode': 0.16; 'url:pocoo': 0.16; 'all.': 0.16; 'wrote:': 0.18; "hasn't": 0.19; 'written': 0.21; '>>>': 0.22; 'appears': 0.22; 'example': 0.22; 'header:User-Agent:1': 0.23; 'necessary.': 0.24; 'unicode': 0.24; 'mon,': 0.24; 'script': 0.25; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'unix': 0.29; "doesn't": 0.30; 'code': 0.31; '+0100,': 0.31; 'probably': 0.32; 'checking': 0.33; 'skip:_ 10': 0.34; 'could': 0.34; 'but': 0.35; 'there': 0.35; "he's": 0.36; 'surely': 0.36; 'doing': 0.36; 'url:org': 0.36; 'wrong': 0.37; 'to:addr:python-list': 0.38; 'rather': 0.38; 'anything': 0.39; '12,': 0.39; 'itself': 0.39; 'url:12': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'guy': 0.60; 'ian': 0.60; 'is.': 0.60; 'url:5': 0.61; 'our': 0.64; 'reads': 0.68; 'subject:know': 0.84; 'url:2014': 0.84; 'subject:you': 0.87; 'subject:want': 0.91 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=etNRz+ZX c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=1oDRhzKAKukA:10 a=J8LrewYjDQYA:10 a=ihvODaAuJD4A:10 a=IkcTkHD0fZMA:10 a=EBOSESyhAAAA:8 a=NLZqzBF-AAAA:8 a=Zz4V2kY4AAAA:8 a=iua7l7GMjz8y7VcADcgA:9 a=QEXdDO2ut3YA:10 a=_dQi-Dcv4p4A:10 X-AUTH: mrabarnett:2500 Date: Mon, 12 May 2014 20:42:22 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Everything you did not want to know about Unicode in Python 3 References: <8P7cv.78617$Sp6.8377@fx15.am4> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399923932 news.xs4all.nl 2858 [2001:888:2000:d::a6]:41512 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71400 On 2014-05-12 19:31, Ian Kelly wrote: > On Mon, May 12, 2014 at 11:47 AM, alister > wrote: >> On Mon, 12 May 2014 16:19:17 +0100, Mark Lawrence wrote: >> >>> This was *NOT* written by our resident unicode expert >>> http://lucumr.pocoo.org/2014/5/12/everything-about-unicode/ >>> >>> Posted as I thought it would make a rather pleasant change from >>> interminable threads about names vs values vs variables vs objects. >> >> Surely those example programs are not the pythonoic way to do things or >> am i missing something? > > The _is_binary_reader and _is_binary_writer functions look like they > could be simplified by calling isinstance on the io object itself > against io.TextIOBase, io.BufferedIOBase or io.RawIOBase, rather than > doing those odd 0-length reads and writes. And then perhaps those > exception-swallowing try-excepts wouldn't be necessary. But perhaps > there's a non-obvious reason why it's written the way it is. > How about checking sys.stdin.mode and sys.stdout.mode? > And there appears to be a bug where everything *except* the filename > '-' is treated as stdin, so the script probably hasn't been tested at > all. > >> if those code samples are anything to go by this guy makes JMF look >> sensible. > > This is an ad hominem. Just because his code sucks doesn't mean he's > wrong about the state of Unicode and UNIX in Python 3. >