Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55446
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Subject | Re: Efficency help for a Calculator Program |
| Date | 2013-10-03 19:15 -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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.698.1380842159.18130.python-list@python.org> (permalink) |
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 | 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