Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Chase Newsgroups: comp.lang.python Subject: Re: Guido sees the light: PEP 8 updated Date: Tue, 19 Apr 2016 08:31:01 -0500 Lines: 82 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=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de FBCV1yew0maUFvPn0LNgdQDoQVdb6/FlGN/eGuqkqaNQ== 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; 'params': 0.07; 'subject:PEP': 0.07; 'issue:': 0.09; 'name)': 0.09; 'obligated': 0.09; 'spelling': 0.09; 'splitting': 0.09; 'worse': 0.09; 'def': 0.13; '-tkc': 0.16; 'bars': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'margin': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'variable': 0.18; 'changes': 0.20; 'portion': 0.20; '(the': 0.22; 'advocate': 0.22; 'css,': 0.22; 'flows': 0.22; 'trying': 0.22; 'appears': 0.23; 'changes,': 0.23; 'thus': 0.24; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'compare': 0.27; 'separate': 0.27; 'moved': 0.27; 'indentation': 0.29; 'pep': 0.29; 'starts': 0.29; 'comments': 0.30; 'code': 0.30; 'strongly': 0.30; 'possibly': 0.32; 'usually': 0.33; 'align': 0.33; 'foo': 0.33; 'changing': 0.34; 'skip:d 20': 0.34; 'gets': 0.35; 'something': 0.35; 'comment': 0.35; 'should': 0.36; '(and': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'two': 0.37; 'charset:us-ascii': 0.37; '(with': 0.38; 'end': 0.39; 'why': 0.39; 'subject:the': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'side': 0.62; 'back': 0.62; 'above,': 0.63; 'goal': 0.64; 'distinguish': 0.84; 'received:23': 0.84; 'roman': 0.84; 'them)': 0.84; 'aligning': 0.91 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1461072896779:234031082 X-MC-Ingress-Time: 1461072896779 In-Reply-To: <87potlrfa1.fsf@elektro.pacujo.net> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) X-AuthUser: tim@thechases.com 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: <20160419083101.5cdfe184@bigbox.christie.dr> 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> Xref: csiph.com comp.lang.python:107322 On 2016-04-19 14:47, Marko Rauhamaa wrote: > We need a PEP to distinguish also between: > - typefaces (Times New Roman vs Garamond) > - weights (bold vs thin) > - serifs (with or without) > - sizes (8pt vs 11pt) > - colors (goldenrod vs maroon) Like HTML & CSS, the goal should be to separate the code (HTML) from its presentation (how it appears in your editor). It's why I've taken to using formulaic indenting (one or two indents depending on whether the continued line starts an indented block) rather than trying to align with something in a prior line. It drives me nuts when I globally change the spelling of something (and thus the length of some variable name) and then feel obligated to re-indent my continuations to get them to line back up with some arbitrary paren. Compare def do_something(param1, param2, param3, ): implementation() with just using def do_something(param1, param2, param3, ): implementation() (or, if you want your params to line up def do_something( param1, param2, param3, ): implementation() which is usually how I end up splitting them) When "do_something" changes to "frobify", I don't feel the need to go play with indentation with my scheme. 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) I strongly advocate from keeping the content (the code and its AST) separate from its presentation. -tkc