I use Python in Emacs, with Elpy and iPython. I run code from a file with C-c C-c, but sometimes I would like to terminate the process (keyboard interrupt). I use the same shortcut to try to terminate the process (as per this question).
My goal would be to try to distinguish between killing the whole Python process or just interrupting the kernel. With the above shortcut, it sometimes does the first and sometimes does the second. I am yet to find any clues, how to generalize it.
So, the question is: How to stop the Python process and how to interrupt the kernel?