Another Sets Problem

MRAB python at mrabarnett.plus.com
Tue Dec 29 11:21:31 EST 2009


Victor Subervi wrote:
> On Tue, Dec 29, 2009 at 6:29 AM, Jean-Michel Pichavant 
> <jeanmichel at sequans.com <mailto:jeanmichel at sequans.com>> wrote:
> 
>     Matt Nordhoff wrote:
> 
>         Victor Subervi wrote:
> 
>             On Mon, Dec 28, 2009 at 1:41 PM, MRAB
>             <python at mrabarnett.plus.com <mailto:python at mrabarnett.plus.com>
>             <mailto:python at mrabarnett.plus.com
>             <mailto:python at mrabarnett.plus.com>>> wrote:
> 
>                 DON'T USE BARE EXCEPTS!
> 
>                 (There are 2 in your code.)
> 
>             There are times when they are *necessary*.
> 
>         No, there aren't.
> 
>         Even if there were, this is not one of those situations.
> 
>     And to elaborate a little bit, someone said in this list (sorry,
>     don't remember who) that often people think that making their code
>     robust is one of the top priority, especially when you are providing
>     some services to clients. That could be true. The fact is that most
>     newcomers thinks bare try except will do the trick: "look, my server
>     never crashes". Yes it does not crash, but even worse, it handles
>     exception in an inapropriate way that leads the server to behave in
>     a reliable, yet unpredictable, manner. And that is definitely *not*
>     being robust.
> 
> You all have made very good points about bare excepts. I promise you I 
> will work on this...AFTER I've finished the first working copy of this 
> shopping cart and gotten caught up on my work, and start to clean this 
> shopping cart up to make it truly professional. HOWEVER, there is NO 
> bare except influencing the problem which I am trying to fix. Can we 
> PLEASE set this issue aside and deal with the problem of this post?? 
[snip]

Bare excepts hide bugs. It's very easy to catch exceptions properly.



More information about the Python-list mailing list