Sending ctrl+C break signal in the terminal?
Is it possible to send Ctrl + C ( SIGINT ) to break in the shell? That is something I use quite often, in any python shell. There are many use cases.
Tapping the stop (
[x]) button effectively does the same.
To break execution during runtime, it behaves the same. But there are other cases (due to the syntax of python-language its not unique to pythonista and is shared by ALL shells).
When in the shell, you enter functions and control sequences line by line - so you commit lines before execution. If you make an error, you need to break from that commitment to an indent-level to get your shell back (during this time, the button isn't available to do this, but that would be a good fix).
example: this happens to me fairly often
..if x not in [elm for elm in os.listdir('.').startswith('.')]:
....> # oh shoot. I meant to use os.environ not listdir
........> it thinks im still going. now I need to escape
....> just mashing buttons now
To be fair pythonista handles this better than ipython or cpython. cpython's shell is awful, and ipythons is great but has this syndrome really bad when it comes to functions... you'd have to use it to understand ...
If you're not in a triple-quoted string, typing
;;is guaranteed to produce a syntax error, which breaks you out of the current "chunk". But yes, it would be great if you could use the
[X]button to do that. (I think in Pythonista 1.4 that was possible and the feature was somehow lost in 1.5.)