The Samurai Principle

Grant Edwards invalid at invalid.invalid
Wed Sep 8 19:44:01 CEST 2010

On 2010-09-08, Steven D'Aprano <steve at> wrote:
> On Wed, 08 Sep 2010 14:44:12 +0000, Grant Edwards wrote:
>>> If you don't trap them just right, they cause a stack trace,
>> Not always.  That is the effect of not trapping them at all. However,
>> you can trap them incorrectly -- which can result in hard-to-track down
>> problems.
>> The main example of this is a "bare except" clause that not only catches
>> and handles the "expected" exception but also catches (and
>> mishandles/ignores) an unexpected one.
> Ah, fair enough. That would be a false positive error -- catching too 
> much rather than too little.
> Still, that's no better, or worse, than misinterpreting special error 
> codes that are returned by functions.

No, I didn't mean to imply that was the case.  I agree with your
conclusion.  I find it much easier to screw things up using the
"exceptional return value" method than the "exception raise" method.

Grant Edwards               grant.b.edwards        Yow! Psychoanalysis??
                                  at               I thought this was a nude
                                rap session!!!

More information about the Python-list mailing list