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

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: how to make the below code look better
Date 2015-12-02 23:31 +1100
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>

Show all headers | 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