how to make the below code look better
BartC
bc at freeuk.com
Wed Dec 2 07:20:15 EST 2015
On 02/12/2015 12:11, Ganesh Pal wrote:
> if not os.path.ismount("/tmp"):
> sys.exit("/tmp not mounted.")
> else:
> 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")
> if not validation_errors():
> sys.exit("Validation failed")
> else:
> try:
> compare_results()
> except Exception, e:
> logging.error(e)
> sys.exit("Comparing result failed")
> 3. Any other suggestion ? please
You could make the indentation more consistent. Example:
if not os.path.ismount("/tmp"):
sys.exit("/tmp not mounted.")
else:
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")
if not validation_errors():
sys.exit("Validation failed")
else:
try:
compare_results()
except Exception, e:
logging.error(e)
sys.exit("Comparing result failed")
--
Bartc
More information about the Python-list
mailing list