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; 'output': 0.05; '21,': 0.07; 'lines,': 0.07; 'plenty': 0.07; 'function,': 0.09; 'newline': 0.09; 'trailing': 0.09; 'cc:addr:python-list': 0.11; 'bug': 0.12; "wouldn't": 0.14; '11:59': 0.16; 'comma': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'newline,': 0.16; 'ought': 0.16; 'write,': 0.16; 'subject:python': 0.16; 'applies': 0.16; 'language': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; "doesn't": 0.30; 'statement': 0.30; 'then.': 0.30; 'message- id:@mail.gmail.com': 0.30; 'lines': 0.31; 'that.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'languages': 0.32; 'fri,': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'keyword': 0.36; 'too': 0.37; 'anything': 0.39; 'does': 0.39; 'liked': 0.60; 'here:': 0.62; 'complete': 0.62; 'places': 0.64; 'provide': 0.64; 'more': 0.64; 'different': 0.65; 'mar': 0.68; 'default': 0.69; 'streams': 0.84; '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=zZPLO6VpT3EIP2sb4CbIawxBMWc4BkzoCZ55q8GCzxM=; b=r/dZATuLmrcfs7bepmAd3TFKwd2Dodnpzsl7Alpt5zVtCPgFv/+q8GAbAz3CSK+Wjf WdA9yhMqDUAIFkxuNBRRtwufQiySqH+DhfTN140b5XtSS16/DCQ/tKDmGplvMi0du8LU GCwKwuHqLtp0gArQTjlTms/bO9P6EtsfYeAkIqTAtbjvZzoG4MjFK5eG7uBOmL4ts6Ik PAShykPzXIx90d1bvE0HnIzovWkIzAnOPktBAKo9hnWpo+6FDmGTamLdzU+GiXS6s2pv lAElFGJQlEL7gjkMRwFEPcdSlAaWIzV/2E3BqChMQkufDIjWbCAqf8b+R7k/3UM6r+sg 1FzA== MIME-Version: 1.0 X-Received: by 10.66.118.71 with SMTP id kk7mr50006436pab.14.1395364519142; Thu, 20 Mar 2014 18:15:19 -0700 (PDT) In-Reply-To: <532b8f0d$0$29994$c3e8da3$5496439d@news.astraweb.com> References: <87ob10nbeh.fsf@elektro.pacujo.net> <532B4750.2090006@yahoo.com> <87eh1wpr96.fsf@elektro.pacujo.net> <87a9ckpq7y.fsf@elektro.pacujo.net> <87txasoaqi.fsf@elektro.pacujo.net> <532b8f0d$0$29994$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 21 Mar 2014 12:15:19 +1100 Subject: Re: running python 2 vs 3 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395364527 news.xs4all.nl 2893 [2001:888:2000:d::a6]:52892 X-Complaints-To: abuse@xs4all.nl Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!porbandar.httrack.net!news.httrack.net!feed.ac-versailles.fr!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Xref: csiph.com comp.lang.python:68654 On Fri, Mar 21, 2014 at 11:59 AM, Steven D'Aprano wrote: > The rule of three applies here: anything you do in three different places > ought to be managed by a function. Printing a newline at the end of a > line of output is *incredibly* common. Any language which fails to > provide a print-with-newline function is, frankly, sub-standard. I wouldn't go that far. There are plenty of languages where the default (printf, write, werror, etc) doesn't add the newline, and I wouldn't call the *language* sub-standard for that. But yes, it does bug me now and then. I use my "say" function to produce one or more lines of output in Gypsum, and it guarantees complete lines (because the system works with lines, not streams of characters); and then if I use the "werror" function to write to stderr, I have to remember to add the newline. However, I think Py2's print statement has way too many weirdnesses - the trailing comma (reminiscent of BASIC, where I never liked it either), the whole "soft space" concept, etc. Py3's print function, with the keyword end="", is a lot better, though still a tad verbose. (I don't know of any solution to that.) ChrisA