This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [PATCH] Quitting The Interpreter
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: mwh Nosy List: cdcarter, mwh
Priority: critical Keywords:

Created on 2006-11-21 03:52 by cdcarter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg30642 - (view) Author: Chris Carter (cdcarter) Date: 2006-11-21 03:52
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>
msg30643 - (view) Author: Michael Hudson (mwh) (Python committer) Date: 2006-11-21 09:47
Think what happens when you type 'print __builtin__.__dict__'.

This has been proposed and rejected many times before, please search the python-dev archives for more.
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44260
2006-11-21 03:52:02cdcartercreate