Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ethan Furman Newsgroups: comp.lang.python Subject: Re: Continuing indentation Date: Fri, 04 Mar 2016 09:36:09 -0800 Lines: 52 Message-ID: References: <8760x4bo5h.fsf@elektro.pacujo.net> <871t7sbkex.fsf@elektro.pacujo.net> <87vb53se36.fsf@elektro.pacujo.net> <56d8d33d$0$1585$c3e8da3$5496439d@news.astraweb.com> <56D8DF99.6070808@lucidity.plus.com> <56d905a7$0$1605$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de +nq0D227q8356MNLmhBYHgHBsDNlFHhmExlMP1KGW0Uw== 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; 'operator': 0.03; 'binary': 0.05; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'logic': 0.09; 'message- id:@stoneleaf.us': 0.09; 'operator,': 0.09; 'splitting': 0.09; ':-)': 0.12; '2016': 0.16; 'agree.': 0.16; 'pep8': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'why,': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'preferred': 0.20; "aren't": 0.22; 'arguments': 0.22; 'am,': 0.23; 'code,': 0.23; 'seems': 0.23; 'split': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'fri,': 0.27; 'found.': 0.27; 'tend': 0.27; 'correct': 0.28; 'function': 0.28; 'indentation': 0.29; 'pep': 0.29; 'unlikely': 0.29; '~ethan~': 0.29; "i'm": 0.30; "d'aprano": 0.33; 'steven': 0.33; "i'll": 0.33; 'next': 0.35; 'could': 0.35; 'something': 0.35; 'there': 0.36; 'url:org': 0.36; 'to:addr :python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'wrong': 0.38; 'end': 0.39; 'to:addr:python.org': 0.40; 'where': 0.40; 'charset:windows-1252': 0.62; 'more': 0.63; 'mar': 0.65; 'believe': 0.66; '>>>>>': 0.66; 'aaa': 0.84; 'yyy': 0.97 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:104045 On 03/04/2016 07:25 AM, Ian Kelly wrote: > On Fri, Mar 4, 2016 at 7:03 AM, alister wrote: >> On Fri, 04 Mar 2016 10:12:58 +0000, cl wrote: >> >>> Steven D'Aprano wrote: >>>> On Fri, 4 Mar 2016 12:23 pm, INADA Naoki wrote: >>>> >>>> >>>>>> >>>>>> Indeed. I don't understand why, when splitting a condition such as >>>>>> this, >>>>>> people tend to put the operator at the end of each line. >>>>>> >>>>>> >>>>> Because PEP8 says: >>>>> >>>>>> The preferred place to break around a binary operator is after the >>>>> operator, not before it. http://pep8.org/#maximum-line-length >>>> >>>> PEP 8 is wrong :-) >>>> >>> Yes, I agree. In my mind the logic is:- >>> >>> IF xxx >>> AND yyy AND zzz OR aaa >>> THEN do something >>> >>> The PEP8 correct(er):- >>> >>> IF xxx AND >>> yyy AND zzz OR aaa >>> THEN do something >>> >>> ... just seems all wrong and difficult to understand. >> >> not at all >> the split after the operator shows that their is more to that line >> splitting before & the reader could believe that the condition ends there >> >> PEP 8 is mos definitely correct on this one > > I disagree. When I'm skimming over code, I find it unlikely that I'll > read the last token of the line. That's where trivialities like > arguments to function calls are found. It's much more likely that I'll > read the first token of the next line. And, as any pythonista knows: The conditions aren't over until the indentation changes. ;) -- ~Ethan~