Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103898

Re: Continuing indentation

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Continuing indentation
Date Wed, 02 Mar 2016 22:27:31 +0100
Organization None
Lines 40
Message-ID <mailman.116.1456954063.20602.python-list@python.org> (permalink)
References <CANc-5Uz=mG6r9uw94tizxUh7eT=ftB1+z6d5nwzhDC=8+6YV1w@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de hi7tutui0Bp4sHlQxkxUlAi4XCwzZQ2m3yvI3MGPaSJQ==
Return-Path <python-python-list@m.gmane.org>
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; 'skip:/ 10': 0.07; 'block.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'statements': 0.09; 'python': 0.10; 'output': 0.13; '-name': 0.16; 'complains': 0.16; 'editor,': 0.16; 'egrep': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'suppressing': 0.16; 'xargs': 0.16; 'wrote:': 0.16; 'string': 0.17; 'skip': 0.18; 'creates': 0.18; 'matching': 0.23; 'this:': 0.23; 'second': 0.24; 'tried': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'gnu': 0.27; 'indentation': 0.29; 'mode.': 0.29; 'spaces': 0.29; 'workaround': 0.29; "i'm": 0.30; 'code': 0.30; 'guess': 0.31; 'aside': 0.32; 'common': 0.33; 'impression': 0.33; 'open': 0.33; 'case,': 0.34; 'running': 0.34; 'gives': 0.35; 'next': 0.35; 'text': 0.35; 'problem.': 0.35; 'but': 0.36; 'too': 0.36; 'there': 0.36; 'lines': 0.36; 'tool': 0.36; 'keyword': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'missing': 0.37; 'several': 0.38; 'well.': 0.40; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'space': 0.40; 'some': 0.40; 'care': 0.60; 'overall': 0.72; "'if": 0.84; 'paren': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57bd83ca.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103898

Show key headers only | View raw


Skip Montanaro wrote:

> Running flake8 over some code which has if statements with multiple
> conditions like this:
> 
>     if (some_condition and
>         some_other_condition and
>         some_final_condition):
>         play_bingo()
> 
> the tool complains that the indentation of the conditions is the same
> as the next block.  In this particular case, the overall conditions
> are too long to string together on a single line. I tried placing a
> second space after the if keyword:
> 
>     if  (some_condition and
>          some_other_condition and
>          some_final_condition):
>         play_bingo()
> 
> which solves the matching indentation problem, but creates a multiple
> spaces after keyword problem.  My guess is that adding a space after
> the open paren would provoke a message as well.
> 
> I use GNU Emacs as my text editor, and its python mode.  I'm pretty
> happy with everything (been using it in its current state for several
> years).  Aside from manually or configure-ologically suppressing E129,
> is there a better way to break lines I'm missing which will make
> flake8 happy?

Manually inspecting the output of

$ cd /usr/lib/python3.4
$ find . -name \*.py -print0 | xargs -0 egrep 'if \([^:]+$' --color -A3

[...]

gives the impression that those who do care are a minority and that the most 
common workaround is an extra indent of four spaces.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Continuing indentation Peter Otten <__peter__@web.de> - 2016-03-02 22:27 +0100

csiph-web