>>(Please reply to the tutor list, not to me privately)

whoops

>>Generally, you want to catch the exception at the level that knows what to do 
>>about it. Your function2() isn't handling the exception in any meaningful 
>>sense, it is just converting it to a magic return value. You might as well 
>>just use magic return values everywhere if you do this.

>>Even function1() seems like it is too low-level to handle the error since it 
>>is also just converting the error to a magic return.

>>For short, simple scripts you can often omit exception handling completely. 
>>Any raised exceptions will propagate to the interpreter which will print a 
>>stack trace and exit. This is very handy - you get to see exactly where the 
>>error occured and the details of the exception type and message. This style 
>>may also be appropriate for handling any fatal error even in a complex script.

>>For more complex scripts, for example a server or GUI app, or a script that 
>>processes many items, you probably don't want to exit the script on an error. 
>>In this case you might have a high-level exception handler that logs the 
>>exception and continues. For example here is a loop that processes a list of 
>>items, if there is an error processing an item a traceback is printed and the 
>>processing continues:



I think you are correct that I haven't been letting my raised errors propagate 
high enough.  That helps.  Thanks very much.

ds



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to