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


Groups > comp.lang.python > #55446

Re: Efficency help for a Calculator Program

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'advocate': 0.07; 'subject:help': 0.08; 'except:': 0.09; 'input,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'style.': 0.09; 'terminates': 0.09; 'try:': 0.09; '>on': 0.16; 'emit': 0.16; 'emits': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 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; 'url:home': 0.24; 'header:X -Complaints-To:1': 0.27; 'idea': 0.28; 'chris': 0.29; 'am,': 0.29; 'comment': 0.34; 'test': 0.35; 'really': 0.36; 'useful': 0.36; 'charset:us-ascii': 0.36; 'generic': 0.38; 'to:addr:python-list': 0.38; 'bad': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'simply': 0.61; "you're": 0.61; 'note:': 0.66; 'default': 0.69; 'received:108': 0.93; '2013': 0.98
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Efficency help for a Calculator Program
Date Thu, 03 Oct 2013 19:15:44 -0400
Organization IISS Elusive Unicorn
References <77bde84a-b0ce-4061-bb2e-e6cd23f4282c@googlegroups.com> <gdap49lskt6b1ph9rf3devk52mq5mqphnr@4ax.com> <CAPTjJmpDatnEV-cyx7Bcw_dW7AZphv5U62xWu=b9+8NhW_58bg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host adsl-108-68-176-115.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
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.698.1380842159.18130.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1380842159 news.xs4all.nl 15917 [2001:888:2000:d::a6]:40318
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:55446

Show key headers only | View raw


On Thu, 3 Oct 2013 10:25:47 +1000, Chris Angelico <rosuav@gmail.com>
declaimed the following:

>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.
>
	Note: I DID include a comment that this was NOT good style.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


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