can try expect have if else.

Ben Finney ben+python at benfinney.id.au
Sun Feb 21 12:07:05 EST 2016


Ganesh Pal <ganesh1pal at gmail.com> writes:

> 1. Can we have if else with in a try except block

What result do you get when running that code? What empirical reason do
you have to think it would work or not work?

> 2. How can the above code be improved

The following sequence of statements::

    raise Exception("/nfs_mount is not mounted. Dataset create failed !!!")
    return False

do not make sense. The ‘return‛ statement will never be reached. So your
intent must be something other than what is expressed by that code.

-- 
 \     “Do unto others twenty-five percent better than you expect them |
  `\      to do unto you. (The twenty-five percent is [to correct] for |
_o__)                            error.)” —Linus Pauling's Golden Rule |
Ben Finney



More information about the Python-list mailing list