as an alternative to using pdb, I would have a use for the Python continue
statement in interactive mode, after control-C during a script invocation with python -i
. that way, say at a raw_input('continue->')
prompt in my script, I could break out, inspect/modify things, and go right back to the raw_input
prompt (or whatever开发者_如何学Go code caused an exception) with a continue
command. the break
command outside of a loop could also be repurposed for symmetry, but I'd have less use for that. before submitting a PEP for this, I'd like some feedback from the Python community.
it might be possible to do something similar just using a PYTHONSTARTUP script and the inspect
module, but if so I haven't figured it out yet.
ctrl-C raised a KeyboardInterrupt exception in your script. Since you didn't catch that exception, the program terminated. Only then the interactive prompt appears.
You can't continue because your program is already over. The fact that you pressed Ctrl-C just raised an exception, the program didn't pause at that exact place. It continued execution, up to the last line, and finished.
There's no way to know where you want to continue to. For that you need a real debugger.
精彩评论