Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5089
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!news.giganews.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Tue, 10 May 2011 22:28:13 -0500 |
| Date | Tue, 10 May 2011 22:26:18 -0500 |
| From | Paul Probert <paulprobert@sbcglobal.net> |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.python |
| Subject | Re: Overuse of try/except/else? |
| References | <iqa1fd$4l0$1@dont-email.me> |
| In-Reply-To | <iqa1fd$4l0$1@dont-email.me> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <q7cp98-qu2.ln1@giganews.com> (permalink) |
| Lines | 28 |
| X-Usenet-Provider | http://www.giganews.com |
| X-Trace | sv3-hJj/x5gRuUvAoKSDBzC1k8jfy2qy0/P03LcLRXgmVJLedNnHpkf1T8cqEMZFZ/6EgSxxDv9DVAAGi2g!B55KluTjtDEIRwIaABnT8eK9QsIE/z0zDeVrTA1/xHaQfaG/IbU= |
| X-Complaints-To | abuse@giganews.com |
| X-DMCA-Notifications | http://www.giganews.com/info/dmca.html |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 1907 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:5089 |
Show key headers only | View raw
On 05/09/2011 07:40 PM, Kyle T. Jones wrote: > > It has been hard for me to determine what would constitute overuse. > > Cheers. Well, for me the power of exceptions is that it lets me write much more concise code. For example, suppose I call a routine I wrote over and over, and I have to check for errors on each call. Then you have a long block of code like: if err == 0: x1,err=somefunction(1) if err == o: x2,err=somefunction(2) ... ... but if somefunction just raises an exception on error, then you do try: x1=somefunction(1) x2=somefunction(2) ... ... except: blah blah So for my uses, its handy to let things raise exceptions willy nilly in the lower level functions, and do the catching in the higher level function. Paul Probert
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Overuse of try/except/else? "Kyle T. Jones" <onexpadREMOVE@EVOMERyahoodotyouknow.com> - 2011-05-09 19:40 -0500
Re: Overuse of try/except/else? James Mills <prologic@shortcircuit.net.au> - 2011-05-10 11:09 +1000
Re: Overuse of try/except/else? Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-05-10 11:34 +0200
Re: Overuse of try/except/else? Adam Tauno Williams <awilliam@whitemice.org> - 2011-05-10 07:36 -0400
Re: Overuse of try/except/else? Hans Georg Schaathun <hg@schaathun.net> - 2011-05-10 13:10 +0100
Re: Overuse of try/except/else? Paul Probert <paulprobert@sbcglobal.net> - 2011-05-10 22:26 -0500
Re: Overuse of try/except/else? James Mills <prologic@shortcircuit.net.au> - 2011-05-11 13:37 +1000
Re: Overuse of try/except/else? Daniel Kluev <dan.kluev@gmail.com> - 2011-05-22 00:33 +1100
csiph-web