Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103308 > unrolled thread

Re: can try expect have if else.

Started byBen Finney <ben+python@benfinney.id.au>
First post2016-02-22 04:07 +1100
Last post2016-02-22 04:07 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: can try expect have if else. Ben Finney <ben+python@benfinney.id.au> - 2016-02-22 04:07 +1100

#103308 — Re: can try expect have if else.

FromBen Finney <ben+python@benfinney.id.au>
Date2016-02-22 04:07 +1100
SubjectRe: can try expect have if else.
Message-ID<mailman.16.1456074606.20994.python-list@python.org>
Ganesh Pal <ganesh1pal@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web