示例#1
0
    def ask_exit(self):
        """
        We need to run the :func:`sage.all.quit_sage` function when we
        exit the shell.

        EXAMPLES:

        We install a fake :func:`sage.all.quit_sage`::

            sage: import sage.all
            sage: old_quit = sage.all.quit_sage
            sage: def new_quit(): print "Quitter!!!"
            sage: sage.all.quit_sage = new_quit

        Now, we can check to see that this method works::

            sage: from sage.misc.interpreter import get_test_shell
            sage: shell = get_test_shell()
            sage: shell.ask_exit()
            Quitter!!!
            sage: shell.exit_now
            True

        Clean up after ourselves::

            sage: shell.exit_now = False
            sage: sage.all.quit_sage = old_quit
        """
        from sage.all import quit_sage
        quit_sage()
        super(SageInteractiveShell, self).ask_exit()
示例#2
0
    def ask_exit(self):
        """
        We need to run the :func:`sage.all.quit_sage` function when we
        exit the shell.

        EXAMPLES:

        We install a fake :func:`sage.all.quit_sage`::

            sage: import sage.all
            sage: old_quit = sage.all.quit_sage
            sage: def new_quit(): print "Quitter!!!"
            sage: sage.all.quit_sage = new_quit

        Now, we can check to see that this method works::

            sage: from sage.misc.interpreter import get_test_shell
            sage: shell = get_test_shell()
            sage: shell.ask_exit()
            Quitter!!!
            sage: shell.exit_now
            True

        Clean up after ourselves::

            sage: shell.exit_now = False
            sage: sage.all.quit_sage = old_quit
        """
        from sage.all import quit_sage
        quit_sage()
        super(SageInteractiveShell, self).ask_exit()
 def quit(shell):
     quit_sage()