[IPython-dev] exit magic vs exit function(s?) for qtconsole

Erik Tollerud erik.tollerud@gmail....
Wed Oct 20 03:42:35 CDT 2010


I've been trying to re-work the "exit" command for the
ipython-qtconsole so that it doesn't bring up the window asking if the
console and/or kernel should be closed.  It's nice to have a console
command to do this quickly - as Fernando pointed out, presumably no
one accidentally types "exit" without meaning to do it.  I managed to
get this working great using the %exit magic command, and added a
"%exit -k" command that keeps the kernel running but kills the console
- see http://github.com/eteq/ipython/tree/qt-exiting if you're
interested.

The trouble is, if I do either "exit" or "exit()" at the console, it
goes to the exit *function* instead of the exit magic command.  In
fact, "exit()" and "exit" seem to follow very different code paths
(one is the IPython.core.quitter.Quitter class, and I'm not sure where
the other one gets hooked in).  Is there a particular reason why there
are three different versions of "exit"?  And if not, is there a
straightforward way to get the exit magic to by default override the
other two and use only the magic command in the qtconsole?

Thanks!

-- 
Erik Tollerud


More information about the IPython-dev mailing list