Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55393
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed0.kamp.net!newsfeed.kamp.net!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'advocate': 0.07; 'subject:help': 0.08; 'except:': 0.09; 'happen,': 0.09; 'input,': 0.09; 'terminates': 0.09; 'try:': 0.09; 'emit': 0.16; 'emits': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sys.exit(1)': 0.16; 'terminate.': 0.16; 'values?': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'programming': 0.22; 'print': 0.22; 'error': 0.23; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'something': 0.35; 'test': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'useful': 0.36; 'generic': 0.38; 'to:addr:python- list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'simply': 0.61; "you're": 0.61; 'default': 0.69; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=7zkskGtbifkNma4TeOyloWJSztzix1+VqUUZ9/qBWvc=; b=MdLVb0v5CiCA7QCJS56+HSpMg4KsC2VX9AtIzR2Wwbv7PrDtbHC1CfFHg0NlTAG/QU VcXWVzTCY/7MAvWrrh2T+V5HofWL5N7+KXqD1QH1cL9P7eDh3VaI/xitnNx9V2hWfRST rBX8HtJyA0ykPwstvqnZGcOqP+XSPVz4pb/Go7eDPgCAW4zkoc+DH1nyWu5mSTl/AUf8 MYj3yOwc2A1HL4xBVCb5YtJ2ppD/E41k4c42hdFlalp4Hq39U5MBf7Bn9yGZffz+9iI5 fbDhD14UY9ldseEL5lO3f6oH5SxHO9TFTmqRiIuGjnlHF4HHOvTaghZ1pHOc4YrvFtYP 8xLg== |
| MIME-Version | 1.0 |
| X-Received | by 10.68.130.131 with SMTP id oe3mr49712pbb.186.1380759948091; Wed, 02 Oct 2013 17:25:48 -0700 (PDT) |
| In-Reply-To | <gdap49lskt6b1ph9rf3devk52mq5mqphnr@4ax.com> |
| References | <77bde84a-b0ce-4061-bb2e-e6cd23f4282c@googlegroups.com> <gdap49lskt6b1ph9rf3devk52mq5mqphnr@4ax.com> |
| Date | Thu, 3 Oct 2013 10:25:47 +1000 |
| Subject | Re: Efficency help for a Calculator Program |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.663.1380759957.18130.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380759957 news.xs4all.nl 15863 [2001:888:2000:d::a6]:54820 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:55393 |
Show key headers only | View raw
On Thu, Oct 3, 2013 at 9:47 AM, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
> try:
> numItems = int(raw_input("\n\nHow many values? "))
> except: #naked exception is not really good programming
> print "Invalid input, exiting..."
> sys.exit(1)
Please don't _ever_ advocate this programming style! Wrapping
something in a try/except that emits a generic message and terminates
is a bad idea - the default behaviour, if you simply let the exception
happen, is to emit a very useful message and terminate. Never test for
any error condition you're not prepared to handle, as the BOFH advised
his boss.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Efficency help for a Calculator Program JonDoe297 <vignesh.harikrishna@gmail.com> - 2013-10-02 03:44 -0700
Re: Efficency help for a Calculator Program Chris Angelico <rosuav@gmail.com> - 2013-10-02 21:01 +1000
Re: Efficency help for a Calculator Program JonDoe297 <vignesh.harikrishna@gmail.com> - 2013-10-02 06:43 -0700
Re: Efficency help for a Calculator Program Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-10-02 19:47 -0400
Re: Efficency help for a Calculator Program Chris Angelico <rosuav@gmail.com> - 2013-10-03 10:25 +1000
Re: Efficency help for a Calculator Program Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-10-03 19:15 -0400
Re: Efficency help for a Calculator Program Chris Angelico <rosuav@gmail.com> - 2013-10-04 16:45 +1000
csiph-web