[Python-checkins] r42948 - in python/trunk: Lib/site.py Misc/NEWS
georg.brandl
python-checkins at python.org
Fri Mar 10 00:22:08 CET 2006
Author: georg.brandl
Date: Fri Mar 10 00:22:06 2006
New Revision: 42948
Modified:
python/trunk/Lib/site.py
python/trunk/Misc/NEWS
Log:
Patch #1446372: quit and exit can now be called from the interactive
interpreter to exit.
Modified: python/trunk/Lib/site.py
==============================================================================
--- python/trunk/Lib/site.py (original)
+++ python/trunk/Lib/site.py Fri Mar 10 00:22:06 2006
@@ -227,12 +227,21 @@
"""
if os.sep == ':':
- exit = 'Use Cmd-Q to quit.'
+ eof = 'Cmd-Q'
elif os.sep == '\\':
- exit = 'Use Ctrl-Z plus Return to exit.'
+ eof = 'Ctrl-Z plus Return'
else:
- exit = 'Use Ctrl-D (i.e. EOF) to exit.'
- __builtin__.quit = __builtin__.exit = exit
+ eof = 'Ctrl-D (i.e. EOF)'
+
+ 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):
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Fri Mar 10 00:22:06 2006
@@ -12,6 +12,9 @@
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
no "doc" argument given. This makes it possible to legitimately use
property() as a decorator to produce a read-only property.
More information about the Python-checkins
mailing list