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


Groups > comp.lang.python > #52942

Re: Exception Handling Practices / Patterns

Date 2013-08-24 17:32 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: Exception Handling Practices / Patterns
References <6446b59c-ff06-4c1b-8c54-79bcb1140be5@googlegroups.com> <52188aa1$0$29986$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.197.1377361957.19984.python-list@python.org> (permalink)

Show all headers | View raw


On 24/08/2013 11:27, Steven D'Aprano wrote:
> On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[snip]
>> * Using
>> Exception is typically a bad. More specific the better.
>
> Yes, you should always try to catch the specific exceptions you care
> about:
>
>
> # Best
> except ValueError, OverflowError, ZeroDivisionError:
>
That should be:

except (ValueError, OverflowError, ZeroDivisionError):

>
> # Not so good
> except Exception:
>
>
> # Worst
> except:
>
[snip]

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


Thread

Exception Handling Practices / Patterns snarf <frank.ruiz@gmail.com> - 2013-08-23 22:25 -0700
  Re: Exception Handling Practices / Patterns Dave Angel <davea@davea.name> - 2013-08-24 07:18 +0000
    Re: Exception Handling Practices / Patterns frank.ruiz@gmail.com - 2013-08-24 16:30 -0700
  Re: Exception Handling Practices / Patterns Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-24 10:27 +0000
    Re: Exception Handling Practices / Patterns MRAB <python@mrabarnett.plus.com> - 2013-08-24 17:32 +0100
    Re: Exception Handling Practices / Patterns Terry Reedy <tjreedy@udel.edu> - 2013-08-24 15:57 -0400
      Re: Exception Handling Practices / Patterns Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-24 23:11 +0000
    Re: Exception Handling Practices / Patterns frank.ruiz@gmail.com - 2013-08-24 16:32 -0700

csiph-web