Commit 24cb053b authored by Georg Brandl's avatar Georg Brandl

Patch #1446372: quit and exit can now be called from the interactive

interpreter to exit.
parent ca4d08b6
...@@ -227,12 +227,21 @@ def setquit(): ...@@ -227,12 +227,21 @@ def setquit():
""" """
if os.sep == ':': if os.sep == ':':
exit = 'Use Cmd-Q to quit.' eof = 'Cmd-Q'
elif os.sep == '\\': elif os.sep == '\\':
exit = 'Use Ctrl-Z plus Return to exit.' eof = 'Ctrl-Z plus Return'
else: else:
exit = 'Use Ctrl-D (i.e. EOF) to exit.' eof = 'Ctrl-D (i.e. EOF)'
__builtin__.quit = __builtin__.exit = exit
class Quitter(object):
def __init__(self, name):
self.name = name
def __repr__(self):
return 'Use %s() or %s to exit' % (self.name, eof)
def __call__(self, code=None):
raise SystemExit(code)
__builtin__.quit = Quitter('quit')
__builtin__.exit = Quitter('exit')
class _Printer(object): class _Printer(object):
......
...@@ -12,6 +12,9 @@ What's New in Python 2.5 alpha 1? ...@@ -12,6 +12,9 @@ What's New in Python 2.5 alpha 1?
Core and builtins Core and builtins
----------------- -----------------
- Patch #1446372: quit and exit can now be called from the interactive
interpreter to exit.
- Patch #1434038: property() now uses the getter's docstring if there is - Patch #1434038: property() now uses the getter's docstring if there is
no "doc" argument given. This makes it possible to legitimately use no "doc" argument given. This makes it possible to legitimately use
property() as a decorator to produce a read-only property. property() as a decorator to produce a read-only property.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment