Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico 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: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de kQ0+pcHjQtnzz8FYdCcvWQr3fZXRh/A3M5ZOKmw05RkA== Return-Path: 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: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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:99875 On Wed, Dec 2, 2015 at 11:20 PM, BartC 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