Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'assignment': 0.07; 'lines,': 0.07; 'subject:PEP': 0.07; 'pep': 0.09; 'reformat': 0.09; 'terms,': 0.09; 'trailing': 0.09; 'wrapped': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'ast': 0.16; 'conveying': 0.16; 'conveys': 0.16; 'corresponds': 0.16; 'elements,': 0.16; 'examples:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'obviously,': 0.16; 'stuff.': 0.16; '(you': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'cc:addr:python.org': 0.22; 'circular': 0.24; 'logical': 0.24; 'space.': 0.24; 'cc:2**0': 0.24; 'compare': 0.26; 'order.': 0.26; 'subject: : ': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'comments': 0.31; 'lines': 0.31; 'argue': 0.31; 'breaking': 0.31; 'comments,': 0.31; 'indentation': 0.31; 'strip': 0.31; 'though.': 0.31; 'vertical': 0.31; 'text': 0.33; 'fri,': 0.33; 'comment': 0.34; "can't": 0.35; 'case,': 0.35; 'definition': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'useful': 0.36; 'should': 0.36; 'two': 0.37; 'area': 0.37; 'expressed': 0.37; 'pm,': 0.38; 'anything': 0.39; 'how': 0.40; 'information,': 0.61; 'first': 0.61; 'information': 0.63; 'provide': 0.64; 'effectively': 0.66; 'worth': 0.66; 'believe': 0.68; 'lose': 0.68; 'real-world': 0.68; 'characters,': 0.84; 'irrelevant': 0.84; 'presumably': 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=VNY4Wb4dkxg1LDSMM9DX1HLcjK49oQi8+JruXvuhvrI=; b=icBItDxTLziuFePWysGC2L7ZuoAsiLRv802mKTO5pg94fHsIs5HOpwrViqQB48RBY5 DGxb2wpzmUIR3nY5gGI6tZ0b2V9v7TpUSmEkdvbAHOn6zyvDgHEhptuy8/V3K3jv2sD2 jue6oWo7cOBekx3Dk5G57UjL73WH6+ZCPTtzKq0XT2f19f9Hybyj0IxVjHn82VUSvGsL BmkINtrpvulfEdO40AKbHnezI1kva49yycbmP0e3TB/pZjfngkX2vO9GOiiuPaBFBF7n gzgWuP9x3B2LHLa+3c/LPwg8UbuxGSW/uoLJVF554lokJQBOrFvxQjP97zcKTeBE0BN1 MUNg== MIME-Version: 1.0 X-Received: by 10.194.109.68 with SMTP id hq4mr13227994wjb.21.1400233225847; Fri, 16 May 2014 02:40:25 -0700 (PDT) In-Reply-To: <87d2fe9j53.fsf@elektro.pacujo.net> References: <5373f400$0$24922$e4fe514c@dreader36.news.xs4all.nl> <600f69c8-541f-4fae-a3db-4da33b776046@googlegroups.com> <87a9ajb36d.fsf@elektro.pacujo.net> <78ac407a-c429-4a7a-93c9-5d83e0f09cbb@googlegroups.com> <8761l7b05y.fsf@elektro.pacujo.net> <5375af57$0$29977$c3e8da3$5496439d@news.astraweb.com> <87k39m9pib.fsf@elektro.pacujo.net> <87d2fe9j53.fsf@elektro.pacujo.net> Date: Fri, 16 May 2014 19:40:25 +1000 Subject: Re: PEP 8 : Maximum line Length : 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: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1400233228 news.xs4all.nl 2966 [2001:888:2000:d::a6]:58025 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71653 On Fri, May 16, 2014 at 7:18 PM, Marko Rauhamaa wrote: > If every bit of your Python text conveys information, obviously, it > can't be abstracted. I don't believe that to be the case, though. So > this AST should contain all *actual* information worth conveying and > strip away irrelevant stuff. > > Examples: > > * Function definition order. > > * Indentation depth. > > * Vertical empty space. * Logical layout as expressed by whitespace and specific line breaks. Compare these two assignment statements: area = (base*base + extension*extension + annex*annex + (annex-extension)*annex + triangle*triangle/2 + circle*circle*math.PI + sphere*sphere*4*math.PI) area = (base*base + extension*extension + annex*annex + (annex-extension)*annex + triangle*triangle/2 + circle*circle*math.PI + sphere*sphere*4*math.PI) Both are wrapped to sixty characters, which means they can be indented twenty without breaking PEP 8. One of them takes up only three lines, the other takes up four. But the first one groups the annex's terms, separates out the triangle, groups the circular elements, and presumably corresponds accurately to the (mythical) real-world geometry that it's implementing. How are you going to cope with this distinction? That's real, useful information, which the AST doesn't carry. (You might argue that each of these lines should have a comment at the end of it or above it, which would provide that grouping. But in that case, you lose the canonicalization of anything with trailing comments or interspersed comments, meaning that you effectively can't reformat anything with comments in it.) ChrisA