Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; 'talks': 0.03; 'subject:Python': 0.06; 'binary': 0.07; 'armin': 0.09; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; '~ethan~': 0.09; 'python': 0.11; 'posted': 0.15; 'binary.': 0.16; 'ought': 0.16; 'stdout': 0.16; 'subject:Unicode': 0.16; 'surprises': 0.16; 'wrote:': 0.18; 'not,': 0.20; 'header:User- Agent:1': 0.23; 'simpler': 0.24; 'this:': 0.26; 'header:In-Reply- To:1': 0.27; 'sets': 0.30; 'code': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'file': 0.32; 'text': 0.33; 'open': 0.33; 'url:python': 0.33; 'objects': 0.35; 'there': 0.35; 'data,': 0.36; 'surely': 0.36; 'charset:us-ascii': 0.36; 'url:org': 0.36; 'somebody': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'ian': 0.60; 'is.': 0.60; 'url:3': 0.61; 'received:173': 0.61; 'more': 0.64; 'received:64.5': 0.84; 'streams': 0.84; 'subject:know': 0.84; 'subject:you': 0.87; 'subject:want': 0.91 Date: Tue, 13 May 2014 17:53:31 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 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> <537172eb$0$29980$c3e8da3$5496439d@news.astraweb.com> <5372b493$0$29977$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <5372b493$0$29977$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Exim-ID: 1WkNRr-0007yQ-I5 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:51251 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= 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: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1400031716 news.xs4all.nl 2881 [2001:888:2000:d::a6]:50434 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71524 On 05/13/2014 05:10 PM, Steven D'Aprano wrote: > On Tue, 13 May 2014 10:08:42 -0600, Ian Kelly wrote: > >> Because Python 3 presents stdin and stdout as text streams however, it >> makes them more difficult to use with binary data, which is why Armin >> sets up all that extra code to make sure his file objects are binary. > > What surprises me is how hard that is. Surely there's a simpler way to > open stdin and stdout in binary mode? If not, there ought to be. Somebody already posted this: https://docs.python.org/3/library/sys.html#sys.stdin which talks about .detach(). -- ~Ethan~