Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Guido sees the light: PEP 8 updated Date: Tue, 19 Apr 2016 23:41:06 +1000 Lines: 34 Message-ID: References: <5711c1b3$0$1596$c3e8da3$5496439d@news.astraweb.com> <87shym6kpo.fsf@elektro.pacujo.net> <87h9f26ioa.fsf@elektro.pacujo.net> <1460809922.1918014.580580553.0AE05EE4@webmail.messagingengine.com> <878u0d7az5.fsf@elektro.pacujo.net> <86twix3mc5.fsf@rudin.co.uk> <87potlrfa1.fsf@elektro.pacujo.net> <20160419083101.5cdfe184@bigbox.christie.dr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de qoq6ujPHy6QuFO1+HNWPFAV2IH+3KoMaXviLZxiInuPQ== 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:PEP': 0.07; 'width': 0.07; 'cc:addr:python-list': 0.09; 'issue:': 0.09; 'oh,': 0.09; 'pixel': 0.09; 'worse': 0.09; 'applies': 0.15; '2016': 0.16; 'bars': 0.16; 'bars,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'margin': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'portion': 0.20; 'flows': 0.22; 'code.': 0.23; 'fit': 0.23; 'changes,': 0.23; 'tim': 0.24; 'header :In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'moved': 0.27; 'chase': 0.29; 'code:': 0.29; 'comments': 0.30; 'code': 0.30; "can't": 0.32; 'possibly': 0.32; 'foo': 0.33; "i'll": 0.33; 'changing': 0.34; 'tue,': 0.34; 'gets': 0.35; 'received:google.com': 0.35; 'comment': 0.35; 'lines': 0.36; 'received:209.85': 0.36; '(and': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'subject:the': 0.39; 'side': 0.62; 'above,': 0.63; 'chrisa': 0.84; 'to:none': 0.91; 'aligning': 0.91 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; bh=x9/IdOScaOaYAWg//PIK6cVs0gTzsGG5O88ZSq9aKio=; b=iQ68/fQUkfb3ArbfxmXygEfs5cdIE4d93sCVB1TWLBoAKoX5YqGWmKG+loH/bYx3P3 9n9dIPRwz6C8/F9namU7HAq+Q4w5qT/2iFHkcCTyuQ3IJ0om0B6+1swS3vtU1psQwbKX 3KizBOL1KS+CIIIff0rg5slnyWig/XylpSpSXKJ9LIsiG0P7cfGcmYbc08Io+fiJquTd ag2CD7mUmuOtGzs5c2dWsyimTsawwkA+TLj2EY/1Gk9dPusOuUDgTJ9YqCR1TE+klxF9 ioJajnPlBS0YQ+ECBlxkoWjO0vdlE/zNwNAHX7hP1I4/BWw0OMkfU6cbKAW84CSWrfgo lZ1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=x9/IdOScaOaYAWg//PIK6cVs0gTzsGG5O88ZSq9aKio=; b=Z0E71FD9rkHeNovqHSG5bK7T4mFkqHTTuzfJKM7Gb+ZPOqGAsMcx8YtfhJoC4+pXby zYy2YgKc9DLTAeNTt9AysDLwAZQYanr6D/GCNRG8Xw2StxJb7tpYLHu29TjY0ww8E+Xd p4jG+UTBwPEjC7kUtoq9MCejPI9Bxw82+G1Mapl3NYFyg50EgNkzkI+MGctauXOTDlA5 j0oSG1tMh+l7XVbnSCy+GGOiJ4Iu2anrKqTEsdQHhrZr3ZMndIVevMQ7tKy5pQYRgG4V jNmzE68p58arPqY0WqQm+RsClCAzCNGQd0ipy6oUcI7ykug/QXpBeZmMIiMM+HrB/AGc PP9g== X-Gm-Message-State: AOPr4FWCogcsLNiNDmGkudqZTyTCrfQKjQxJnoofV78zjtkfLeHP0kNkCJsxmpWGctlkLj5VQ6oHfTJGOdrtRw== X-Received: by 10.50.221.169 with SMTP id qf9mr3951183igc.13.1461073266395; Tue, 19 Apr 2016 06:41:06 -0700 (PDT) In-Reply-To: <20160419083101.5cdfe184@bigbox.christie.dr> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <5711c1b3$0$1596$c3e8da3$5496439d@news.astraweb.com> <87shym6kpo.fsf@elektro.pacujo.net> <87h9f26ioa.fsf@elektro.pacujo.net> <1460809922.1918014.580580553.0AE05EE4@webmail.messagingengine.com> <878u0d7az5.fsf@elektro.pacujo.net> <86twix3mc5.fsf@rudin.co.uk> <87potlrfa1.fsf@elektro.pacujo.net> <20160419083101.5cdfe184@bigbox.christie.dr> Xref: csiph.com comp.lang.python:107323 On Tue, Apr 19, 2016 at 11:31 PM, Tim Chase wrote: > Likewise, I detest aligning comments and almost always prefer to put > them in a neighboring line if there's continuation: > > foo = bar * 3 + 2 # we have 3 bars > # plus one for margin on either side > > changing the length of the code portion (say, s/bar/inner_width/) will > require re-indenting (and possibly re-flowing) the comments. > > It's even worse if the comment flows to an unrelated line > > foo = bar * 3 + 2 # we have 3 bars > result = apply(bar) # plus one for margin on either side > > Now, if either line of *code* changes, it requires rejiggering the > comment indentation. > > If the comment gets moved above, it's no longer an issue: > > # we have 3 bars plus one for margin on either side > foo = bar * 3 + 2 > result = apply(bar) Oh, absolutely! If the right-hand comment can't fit in the right-hand-side, it needs to move above the code. The only time I'll "wrap" that kind of comment is when it actually applies to both lines of code: width = bar * 3 + 2 # we have 3x2 bars, plus one... height = bar * 2 + 2 # ... pixel of margin on all sides ChrisA