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


Groups > comp.lang.python > #99875

Re: how to make the below code look better

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: how to make the below code look better
Date Wed, 2 Dec 2015 23:31:54 +1100
Lines 25
Message-ID <mailman.122.1449059517.14615.python-list@python.org> (permalink)
References <mailman.120.1449058284.14615.python-list@python.org> <n3mnhi$ce5$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de kQ0+pcHjQtnzz8FYdCcvWQr3fZXRh/A3M5ZOKmw05RkA==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; 'exception,': 0.09; 'example:': 0.10; 'wed,': 0.15; 'failed")': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'try:': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'otherwise,': 0.20; 'dec': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'indentation': 0.29; 'fixed': 0.31; 'another': 0.32; 'except': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'but': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'subject:the': 0.39; 'more': 0.63; 'backup': 0.66; 'chrisa': 0.84; 'subject:below': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=h0revanGEuglvP+3lqodk95BAWn7Ywvjiqj30wozy4Y=; b=M4qlYLEqVTs2f3K6H0fKgej5pusLVrYjyJBPTFw+t0zok0HRwVvJsMN+e/EnNFPgmw tFJN8UlHWinbAsUXqQIIpYcjTFQdxAr1BzZEC3U3zcPGDm51PfBTfz+YEW0tqN6LPrPG uipdwvQVS+Xh+D64aEtdE/8y6SpLSexAFjypC4W8a8yRIwcuSR+6L3cWuh782cbsf55c VYQ1vKno85UoeHtBPQotmYQHzqDuf5R4RS+Xo9r7vrSek9/SHGFgrSslT+MlpK/QtoxL HBYQsrehRDwa7ESEYkrguHuDuE5SIZyl1KZBdkVJdmq3RyYfVcq+4p0THeftlqB7RvYJ JpgA==
X-Received by 10.107.3.163 with SMTP id e35mr3059654ioi.157.1449059514714; Wed, 02 Dec 2015 04:31:54 -0800 (PST)
In-Reply-To <n3mnhi$ce5$1@dont-email.me>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
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:99875

Show key headers only | View raw


On Wed, Dec 2, 2015 at 11:20 PM, BartC <bc@freeuk.com> wrote:
> You could make the indentation more consistent. Example:

You fixed one indentation error...

>     if create_dataset() and check_permission():
>         try:
>             run_full_back_up()
>             run_partial_back_up()
>         except Exception, e:
>             logging.error(e)
>             sys.exit("Running backup failed")

... but introduced another :)

>         try:
>             compare_results()
>             except Exception, e:
>                 logging.error(e)
>                 sys.exit("Comparing result failed")

These last three lines need to be unindented one level. Otherwise,
Bart's recommendation is a good one.

ChrisA

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


Thread

how to make the below code look better Ganesh Pal <ganesh1pal@gmail.com> - 2015-12-02 17:41 +0530
  Re: how to make the below code look better BartC <bc@freeuk.com> - 2015-12-02 12:20 +0000
    Re: how to make the below code look better Chris Angelico <rosuav@gmail.com> - 2015-12-02 23:31 +1100
  Re: how to make the below code look better Steven D'Aprano <steve@pearwood.info> - 2015-12-03 00:28 +1100
    Re: how to make the below code look better Chris Angelico <rosuav@gmail.com> - 2015-12-03 00:49 +1100
  Re: how to make the below code look better me <self@example.org> - 2015-12-02 15:23 +0000

csiph-web