Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #98271
| X-Received | by 10.129.73.198 with SMTP id w189mr4764451ywa.5.1446694899503; Wed, 04 Nov 2015 19:41:39 -0800 (PST) |
|---|---|
| X-Received | by 10.50.142.66 with SMTP id ru2mr9670igb.3.1446694899471; Wed, 04 Nov 2015 19:41:39 -0800 (PST) |
| Path | csiph.com!au2pb.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!m48no5294246qgd.0!news-out.google.com!z4ni46898ign.0!nntp.google.com!i2no4460237igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Wed, 4 Nov 2015 19:41:38 -0800 (PST) |
| In-Reply-To | <n18fmg$oj6$1@reader1.panix.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=109.60.101.192; posting-account=19izYAoAAAA9JBIU5jzsuVhoPybSlW8- |
| NNTP-Posting-Host | 109.60.101.192 |
| References | <4b303213-62e2-42d4-b2f6-4fc1f6025944@googlegroups.com> <n18fmg$oj6$1@reader1.panix.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <e134f1a3-89cc-4497-807e-3dd0836fb5e6@googlegroups.com> (permalink) |
| Subject | Re: How to handle exceptions properly in a pythonic way? |
| From | zljubisic@gmail.com |
| Injection-Date | Thu, 05 Nov 2015 03:41:39 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-Received-Bytes | 1803 |
| X-Received-Body-CRC | 309509354 |
| Xref | csiph.com comp.lang.python:98271 |
Show key headers only | View raw
> The best way is probably to do nothing at all, and let the caller handle > any exceptions. In that case every call of the get_html function has to be in the try/except block with many exceptions. Sometimes, it is enough just to know whether I managed to get the html or not. In that case, I could for example, in get_html have try/except block which will as result raise let's say NoHtml custom exception or return some special value. Raising an exception forces me to put every call of the get_html function in try/except block. If I am returning a special value, than I can call get_html and then test the value. I am not sure which approach is better.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to handle exceptions properly in a pythonic way? zljubisic@gmail.com - 2015-11-02 11:24 -0800
Re: How to handle exceptions properly in a pythonic way? John Gordon <gordon@panix.com> - 2015-11-02 20:05 +0000
Re: How to handle exceptions properly in a pythonic way? zljubisic@gmail.com - 2015-11-04 19:41 -0800
Re: How to handle exceptions properly in a pythonic way? Chris Angelico <rosuav@gmail.com> - 2015-11-05 14:58 +1100
Re: How to handle exceptions properly in a pythonic way? zljubisic@gmail.com - 2015-11-04 20:18 -0800
Re: How to handle exceptions properly in a pythonic way? Chris Angelico <rosuav@gmail.com> - 2015-11-05 15:51 +1100
Re: How to handle exceptions properly in a pythonic way? zljubisic@gmail.com - 2015-11-09 13:43 -0800
Re: How to handle exceptions properly in a pythonic way? tian.su.yale@gmail.com - 2015-11-04 21:02 -0800
Re: How to handle exceptions properly in a pythonic way? Ian Kelly <ian.g.kelly@gmail.com> - 2015-11-02 13:58 -0700
Re: How to handle exceptions properly in a pythonic way? zljubisic@gmail.com - 2015-11-04 20:11 -0800
Re: How to handle exceptions properly in a pythonic way? tian.su.yale@gmail.com - 2015-11-04 21:15 -0800
Re: How to handle exceptions properly in a pythonic way? zljubisic@gmail.com - 2015-11-09 13:36 -0800
csiph-web