Emanuele D'Arrigo wrote: > I'm pondering on what is a bit of a philosophical dilemma. > When should I throw an exception and when should I not? > > Suppose I have myFunc1() calling myFunc2() which in turn calls myFunc3 > (). > Suppose myFunc3() has detected a problem. What should it do? > > Throw an exception, forcing myFunc2() to handle it and/or trigger > another exception for myFunc1() to deal with? Or should it simply > return a meaningful error code, for myFunc2() and myFunc1() to handle > as an option but not forcing them to do so? > Remember that with exceptions, if Func2 doesn't want to process the exception it doesn't have to do anything at all to have the exception re-raised: it simply doesn't trap the exception.
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list