]> granicus.if.org Git - python/commitdiff
Add built-in string variables 'quit' and 'exit' that display a hint on
authorGuido van Rossum <guido@python.org>
Fri, 7 Aug 1998 18:01:14 +0000 (18:01 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 7 Aug 1998 18:01:14 +0000 (18:01 +0000)
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.

Lib/site.py

index 4ef8cb8455cfa572f190b46f5b637a70a7bd459a..fc92989dc2878ddba4b2598e42c41c6eca0be403 100644 (file)
@@ -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: