Resuming the execution in an except clause seems unclean and unlikely. What
about the context? Where in the stack to resume? This would lead to more
problems than anything else.
Here i think we are basically not dealing with exceptions but signals, and this
might work as expected:
import signal
def signal_handler(signal_number, frame):
ret = raw_input('Really abort? (y/n) ')
if ret == 'y':
print('Committing Hara Kiri')
sys.exit(0)
## Install the signal handler:
signal.signal(signal.SIGINT, signal_handler)
Philippe
> From: Navin Kabra <[email protected]>
>>
>> On Sun, Nov 20, 2011 at 2:48 PM, <[email protected]> wrote:
>>
>>> Are you 100% certain that this mechanism is not available in Python.?
>>> I think this is very generic usecase of exception handling. !?
>>>
>>
>> While I'm not 100% certain that this is not available in Python, I am 100%
>> certain that this is not a "generic usecase of exception handling". Can you
>> give examples in other languages?
>>
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers