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


Groups > comp.lang.python > #103308

Re: can try expect have if else.

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail
From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: can try expect have if else.
Date Mon, 22 Feb 2016 04:07:05 +1100
Lines 23
Message-ID <mailman.16.1456074606.20994.python-list@python.org> (permalink)
References <CACT3xuWMtxjC+6idsj_RfWVXLS-QCzQSdGaj2Kk4g4_EH9_wPA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de aYw+mv2h876zTbImWi+IOgNmmcnPefgnoEh510Z7aiUA==
Cancel-Lock sha1:HcLd/5NO4ch/oewb+fhq7gZ11lA=
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.053
X-Spam-Evidence '*H*': 0.89; '*S*': 0.00; 'reached.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'code?': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; '(the': 0.22; 'code.': 0.23; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'sequence': 0.27; 'raise': 0.29; 'code': 0.30; 'statement': 0.32; 'rule': 0.33; 'except': 0.34; 'running': 0.34; 'false': 0.35; 'something': 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'received:org': 0.37; 'expressed': 0.39; 'skip:e 20': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'improved': 0.63; 'you.': 0.64; 'intent': 0.66; 'percent': 0.66; 'subject:have': 0.80; '_o__)': 0.84; 'received:125': 0.84; 'subject:try': 0.84
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103308

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web