Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.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.02; 'programmer': 0.03; 'subject:Python': 0.06; 'binary': 0.07; 'bytes,': 0.09; 'encode': 0.09; 'if,': 0.09; 'newline': 0.09; 'cc:addr:python-list': 0.11; 'add,': 0.16; 'binary.': 0.16; 'encodings': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lengths': 0.16; 'screen,': 0.16; 'stdout': 0.16; 'sys.stdout': 0.16; 'unchanged,': 0.16; 'unicode,': 0.16; 'work"': 0.16; 'wrote:': 0.18; 'possible,': 0.19; 'thu,': 0.19; 'cc:addr:python.org': 0.22; "shouldn't": 0.24; 'text,': 0.24; 'text.': 0.24; 'unicode': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'options': 0.25; 'header:In-Reply-To:1': 0.27; 'unix': 0.29; 'message-id:@mail.gmail.com': 0.30; 'work.': 0.31; 'code': 0.31; 'assumes': 0.31; 'pipe': 0.31; 'subject:some': 0.31; 'figure': 0.32; 'text': 0.33; 'there,': 0.34; 'problem': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'being': 0.38; 'pm,': 0.38; 'expect': 0.39; 'even': 0.60; 'worry': 0.60; 'most': 0.60; "you're": 0.61; 'great': 0.65; 'etc,': 0.84; 'negotiate': 0.84; 'streams': 0.84; 'lift': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=IOoR1MJ3HUb53aJX+KknoHSyf1tABxQygnrdjUXk5ls=; b=F1qcy4gLguKWFQc+WUwMgy8jOs64yyUyDtrmEk9iMTGtf18BXlB/f7lV+xZrVIusyX 8PDNDDFQYOtV/qwh/Rg+SFyNyW7S3A2X5BZIQupty6WobL5AXgsurPA9lGf1JDqibmXo WAQwKcxlHEuOSLpfDAMuRyLqIX79W7XPG8QGjuCR0a+pIblhCc08FXE5h1v0jpwsuaJE kd+zXujkaXRvxFireA51THargquJZ7IyvhIhDCdNW18ycOSTXnImWkkoB1jN9aanYQRP eZhOTDhRu/mHf4JG8+a1mShRR0yAHsGj5hnIyaWqws0ua+kcx8Tcu6pxMlFL2khKWjwi OQjQ== MIME-Version: 1.0 X-Received: by 10.52.117.41 with SMTP id kb9mr1304155vdb.97.1401953426434; Thu, 05 Jun 2014 00:30:26 -0700 (PDT) In-Reply-To: <87a99r7rmx.fsf@elektro.pacujo.net> References: <538a8f48$0$29978$c3e8da3$5496439d@news.astraweb.com> <538bcfff$0$29978$c3e8da3$5496439d@news.astraweb.com> <538C5BB8.1020702@chamonix.reportlab.co.uk> <538f1a61$0$29978$c3e8da3$5496439d@news.astraweb.com> <87a99r7rmx.fsf@elektro.pacujo.net> Date: Thu, 5 Jun 2014 17:30:26 +1000 Subject: Re: Python 3.2 has some deadly infection From: Chris Angelico Cc: "python-list@python.org" 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401953434 news.xs4all.nl 2852 [2001:888:2000:d::a6]:45686 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72687 On Thu, Jun 5, 2014 at 5:16 PM, Marko Rauhamaa wrote: > No problem there, only should sys.stdin and sys.stdout carry the > decoding/encoding out or should it be left for the program. The most normal thing to do with the standard streams is to have them produce text, and as much as possible, you shouldn't have to go to great lengths to make that work. If, in Python, I say print("Hello, world!"), I expect that to produce a line of text on the screen, without my code having to encode that to bytes, figure out what sort of newline to add, etc, etc. Even if stdout isn't a tty, chances are you're still working with text. Only an extreme few Unix programs actually manipulate binary standard streams (some, like cat, will pipe binary through unchanged, but even cat assumes text for options like -n); those few should be the ones to have to worry about setting stdin and stdout to be binary. In the same way that we have double-quoted strings being Unicode strings, we should have print() and input() "naturally just work" with Unicode, which means they should negotiate encodings with the system without the programmer having to lift a finger. ChrisA