summaryrefslogtreecommitdiffstats
path: root/Lib/site.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-08-07 18:01:14 (GMT)
committerGuido van Rossum <guido@python.org>1998-08-07 18:01:14 (GMT)
commitd89fa0c5761254c970af72e5abcea420fd23e893 (patch)
tree3040dc0c806c06a5e0398cbb0d7895f128e1f575 /Lib/site.py
parentaee5e26f4b917d2db2e255a3b86f70d747386763 (diff)
downloadcpython-d89fa0c5761254c970af72e5abcea420fd23e893.zip
cpython-d89fa0c5761254c970af72e5abcea420fd23e893.tar.gz
cpython-d89fa0c5761254c970af72e5abcea420fd23e893.tar.bz2
Add built-in string variables 'quit' and 'exit' that display a hint on
how to exit (in a platform dependent way!). We use os.sep to determine which platform we're on, since I expect that this will work better for minority platforms.
Diffstat (limited to 'Lib/site.py')
-rw-r--r--Lib/site.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/site.py b/Lib/site.py
index 4ef8cb8..fc92989 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -107,6 +107,18 @@ for prefix in prefixes:
if os.path.isdir(sitedir):
addsitedir(sitedir)
+# Define new built-ins 'quit' and 'exit'.
+# These are simply strings that display a hint on how to exit.
+if os.sep == ':':
+ exit = 'Use Cmd-Q to quit.'
+elif os.sep == '\\':
+ exit = 'Use Ctrl-Z plus Return to exit.'
+else:
+ exit = 'Use Ctrl-D (i.e. EOF) to exit.'
+import __builtin__
+__builtin__.quit = __builtin__.exit = exit
+del exit
+
try:
import sitecustomize # Run arbitrary site specific code
except ImportError: