[ python-Bugs-1600157 ] [PATCH] Quitting The Interpreter

SourceForge.net noreply at sourceforge.net
Tue Nov 21 04:52:22 CET 2006


Bugs item #1600157, was opened at 2006-11-20 21:52
Message generated for change (Settings changed) made by cdcarter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1600157&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
>Priority: 9
Private: No
Submitted By: Chris Carter (cdcarter)
Assigned to: Nobody/Anonymous (nobody)
Summary: [PATCH] Quitting The Interpreter

Initial Comment:
When i type 'quit' in the interpreter, i get a nice little class and method yelling at me, instead of just quitting.

PATCH:
<pre>
def setquit():

    class Quitter(object):
        def __init__(self, name):
            self.name = name
        def __repr__(self):
            quit()
        def __call__(self, code=None):
            # Shells like IDLE catch the SystemExit, but listen when their
            # stdin wrapper is closed.
            try:
                sys.stdin.close()
            except:
                pass
            raise SystemExit(code)
    __builtin__.quit = Quitter('quit')
    __builtin__.exit = Quitter('exit')
</pre>

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1600157&group_id=5470


More information about the Python-bugs-list mailing list