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


Groups > comp.lang.python > #103899

Re: Continuing indentation

Path csiph.com!weretis.net!feeder4.news.weretis.net!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: Continuing indentation
Date Thu, 03 Mar 2016 08:29:27 +1100
Lines 36
Message-ID <mailman.117.1456954179.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=utf-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de ZAkf3NpGOBO/c5MVpIuPxAy366bGOsTxxSsODnomoQxw==
Cancel-Lock sha1:qJTD2pLONrk2ElexPCevCfzvPLA=
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.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'continuation': 0.07; 'block.': 0.09; 'chairs': 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; 'complains': 0.16; 'compliant,': 0.16; 'editor,': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'suppressing': 0.16; 'skip': 0.18; 'this:': 0.23; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'gnu': 0.27; 'indentation': 0.29; 'mode.': 0.29; 'pep': 0.29; 'read,': 0.29; "i'm": 0.30; 'code': 0.30; 'aside': 0.32; 'running': 0.34; 'next': 0.35; 'text': 0.35; 'there': 0.36; 'lines': 0.36; 'tool': 0.36; 'apply.': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'missing': 0.37; 'anything': 0.38; 'several': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'easy': 0.60; 'remember,': 0.66; '8bit%:21': 0.70; '_o__)': 0.84; 'received:125': 0.84; '\xe2\x80\x9cthis': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
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:103899

Show key headers only | View raw


Skip Montanaro <skip.montanaro@gmail.com> writes:

> 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.

For this reason I prefer to indent all continuation lines 8 spaces::

    if (
            some_condition and
            some_other_condition and
            some_final_condition):
        play_bingo()

> 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?

The style I recommend above is PEP 8 compliant, easy to read, remember,
and apply.

-- 
 \     “This [Bush] Administration is not sinking. This Administration |
  `\   is soaring. If anything they are rearranging the deck chairs on |
_o__)                     the Hindenburg.” —Steven Colbert, 2006-04-29 |
Ben Finney

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


Thread

Re: Continuing indentation Ben Finney <ben+python@benfinney.id.au> - 2016-03-03 08:29 +1100

csiph-web