Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.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.002 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; 'objects.': 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; 'appears': 0.22; 'example': 0.22; '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; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; '+0100,': 0.31; 'probably': 0.32; 'skip:_ 10': 0.34; 'could': 0.34; 'but': 0.35; 'received:google.com': 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; 'guy': 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=c9yCvRLhZF7at79bOQTP8CEOSUJbdb9A8gg3BLyoMP4=; b=VnIXqwVb/ZMOtZIKmFNNkycp1yhn+rZGqNCHsGyu55dFt6zVBEVIZpwNSmHFFftSiJ pB24YIalZz7WxZ5P1nwvT1/6iJ6dlGNG8aqGE/9UFTHebmtTRSB6iObA2I6iKUkRvrBB f+BtfurOQeu09m+BR474QkRQjelhIzozxVKkLzowMmQ/YM/xLCpjPCpsjnfxnrQPazkV rKpdcMfFdFtLrRA+QGF0WaTIQ2ZwptsWwb+CYwg8xqgKl+ZmMU1kdWIKRUQeGWz3UAJ5 cav0PYYqNHunP083vNhl1eGSCEV2gCUiGAWKTCgDIdbVodQRcf/PcFJEPfhpvoYGel/O m7Aw== X-Received: by 10.67.13.134 with SMTP id ey6mr58841266pad.44.1399919511498; Mon, 12 May 2014 11:31:51 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <8P7cv.78617$Sp6.8377@fx15.am4> References: <8P7cv.78617$Sp6.8377@fx15.am4> From: Ian Kelly Date: Mon, 12 May 2014 12:31:11 -0600 Subject: Re: Everything you did not want to know about Unicode in Python 3 To: Python Content-Type: text/plain; charset=UTF-8 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399919514 news.xs4all.nl 2906 [2001:888:2000:d::a6]:57184 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71398 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. 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.