I do a lot of Project Euler coding problems, and Python is my go-to language. A lot of programs typically take forever to complete, so I'm working on implementing something that'll help give diagnostic info on the state of the program: when a KeyboardInterrupt occurs I want to be able print how long the program's been running and some info to help me figure out how long it might still take.
The issue with this is--catching the KeyboardInterrupt when you hit Ctrl-C is exiting the program for me still...and I think it has a lot to do with either the structure of this code, or hopefully something in Python I haven't found yet.
I want my code to resume at the same line right after KeyboardInterrupt is caught.
Here's an example of what this code might look like:
try:
...
...
... #I interrupt code here and hopefully keep going!
...
...
except KeyboardInterrupt:
...
finally:
...
I hope someone understands the purpose of doing this, and can help me find a way to do this, or to work around this ugly way of calling a break from the running code.
programs typically take forever to complete, you may want to read this PyCon lecture on what possibilities you have to alleviate the situation: drive.google.com/open?id=0Bw5McUt95YdeMlNiX2VSR1lFRHM