how to make the below code look better

Chris Angelico rosuav at gmail.com
Wed Dec 2 07:31:54 EST 2015


On Wed, Dec 2, 2015 at 11:20 PM, BartC <bc at 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



More information about the Python-list mailing list