Re: Resume after exception

2005-06-14 Thread Richard Lewis
On Tue, 14 Jun 2005 10:09:30 +0100, "Richard Lewis" <[EMAIL PROTECTED]> said: > Hi there, > > Is it possible to have an 'except' case which passes control back to the > point after the exception occurred? > > e.g. > > # a function to open the file > # raises FileLockedException is file contains

Re: Resume after exception

2005-06-14 Thread [EMAIL PROTECTED]
Richard Lewis schreef: > Is it possible to have an 'except' case which passes control back to the > point after the exception occurred? No, not in Python. The concept has however been discussed, under the name "resumable exceptions". http://www.google.com/search?num=100&q=%22resumable+exceptions%

Re: Resume after exception

2005-06-14 Thread Skip Montanaro
>> Is it possible to have an 'except' case which passes control back to >> the point after the exception occurred? Peter> Basically no, although I could imagine some gross hack with the Peter> frame info and some bytecode hacks that effect a "goto". Someone (I forget who) posted

Re: Resume after exception

2005-06-14 Thread Peter Hansen
Richard Lewis wrote: > Is it possible to have an 'except' case which passes control back to the > point after the exception occurred? Basically no, although I could imagine some gross hack with the frame info and some bytecode hacks that effect a "goto". Basically the stack frame gets unwound t

Re: Resume after exception

2005-06-14 Thread [EMAIL PROTECTED]
Why does the first function return True? Shouldn't it return the file content? That's at least what the function name implies. You call the second function open_command() which returns a boolean. Feels wrong. Where you have written "How?" I suggest that you replace that by: return open_file("foo.b

Re: Resume after exception

2005-06-14 Thread Dan Sommers
On Tue, 14 Jun 2005 10:09:30 +0100, "Richard Lewis" <[EMAIL PROTECTED]> wrote: > Hi there, > Is it possible to have an 'except' case which passes control back to the > point after the exception occurred? Not that I can think of. [ example of "interrupting" a file-reading function in order to ask