From: Jochen V. <vo...@se...> - 2004-11-23 10:24:57
|
Hello John, On Mon, Nov 22, 2004 at 04:50:10PM -0600, John Hunter wrote: > So what is the canonical way to funnel exceptions into GUI dialog > boxes? Isn't this what sys.except_hook is for? I think we should somehow explicitely catch all exceptions we are expecting (maybe near the main loop) and the exception handler could feed them to the backend. Reasons: 1) This looks like the most Pythonic solution to me: exceptions are ment to by caught by "try: ... except: ..." statements 2) This might open a way to differentiate between expected exections (opening a file with a user-supplied file name might fail, if the user mistyped the name -> User should be told and asked for another file name) and unexpected ones which indicate programming errors. 3) Easier to understand flow of control. If you follow a chain of callers through the source code you can see which exections are caught at which place, whereas the except_hook mechanism is more "magical". What do you think? Jochen --=20 http://seehuhn.de/ |