Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3a.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.031 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; '"""': 0.07; 'arguments': 0.09; 'pep': 0.09; 'def': 0.12; '-tkc': 0.16; 'blocks': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'given,': 0.16; 'pep8': 0.16; 'tabs': 0.16; 'url:pep-0008': 0.16; 'url:peps': 0.16; 'ignore': 0.16; 'wrote:': 0.18; 'example': 0.22; 'stick': 0.24; 'url:dev': 0.24; 'options': 0.25; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; 'mix': 0.30; "i'm": 0.30; 'included': 0.31; 'easier': 0.31; 'indentation': 0.31; 'vertical': 0.31; 'option': 0.32; 'url:python': 0.33; 'level.': 0.33; 'style': 0.33; 'add': 0.35; 'instances': 0.36; 'done': 0.36; 'method': 0.36; 'charset :us-ascii': 0.36; 'url:org': 0.36; 'should': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'read': 0.60; 'first': 0.61; 'happen': 0.63; 'more': 0.64; 'alone.': 0.84; 'calls,': 0.84; 'distinguish': 0.84; 'hanging': 0.84; 'received:50.22': 0.84; 'regard.': 0.84; 'insane': 0.93 Date: Fri, 4 Jul 2014 18:35:34 -0500 From: Tim Chase To: python-list@python.org Subject: Re: PEP8 and 4 spaces In-Reply-To: References: <53B59358.2040404@tobiah.org> <53b6019f$0$29985$c3e8da3$5496439d@news.astraweb.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Get-Message-Sender-Via: boston.accountservergroup.com: authenticated_id: tim@thechases.com 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: 61 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1404517000 news.xs4all.nl 2864 [2001:888:2000:d::a6]:53463 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:73982 On 2014-07-05 11:17, Gregory Ewing wrote: > > PEP8 suggests using this style of method invocation: > > > > obj.method(foo, > > bar, > > baz) > > > > which is an effect impossible to do correctly with tabs alone. > > Yes, PEP 8 is self-contradictory in that regard. > I also happen to think that recommendation is insane > for other reasons as well, and cheerfully ignore it. To be fair, in the same section[1] that example is given, it also suggests # More indentation included to distinguish this from the rest. def long_function_name( var_one, var_two, var_three, var_four): print(var_one) # Hanging indents should add a level. foo = long_function_name( var_one, var_two, var_three, var_four) both of which can be done with arbitrary indentation without the need to mix tabs+spaces or use a non-integer multiple of indentation-spaces. I just use these two in all instances and (as you, Greg, advise), "cheerfully ignore [the first form]" The only time I intentionally violate the "don't do these" section """ # Arguments on first line forbidden when not using vertical alignment. foo = long_function_name(var_one, var_two, var_three, var_four) """ is when defining options in optparse: parser.add_option("-v", "--verbose", help="be prolix", action="store_true", dest="verbose", default=False, ) as I find that a little easier to read when I'm scanning large blocks of parser.add_option(...) calls, having the option stick out to the right. -tkc [1] http://legacy.python.org/dev/peps/pep-0008/#indentation