Function Type shows that QUIT and EXIT are one object:
print (type (quit), type (exit))
# & lt; class '_sitebuiltins.quitter' & gt; & lt; class '_sitebuiltins.quitter' & gt;
function ID Returns different identifiers:
print (hex (id (quit), hex (ID (EXIT))
# 0x18caae42b70 0x18caae50630
function Help Returns the same description:
Help on Quitter in Module _sitebuiltins Object:
Class Quitter (Builtins.Object)
| Methods Defined Here:
|
| __Call __ (Self, Code = None)
| Call Self AS A FUNCTION.
|
| __init __ (Self, Name, EOF)
| Initialize Self. See Help (Type (Self)) for Accurate Signature.
|
| __repr __ (Self)
| RETURN REPR (SELF).
|
| ---------------------------------------------------- --------------------
| Data Descriptors Defined Here:
|
| __dict__
| Dictionary for Instance Variables (If Defined)
|
| __Weakref__
| List of Weak References To The Object (If Defined)
in the documentation both functions have a general description
quit (code = none) EXIT (Code = None)
Objects That WHEN Printed, Print A Message Like “Use Quit () or Ctrl-D (I.EOF)
to exit “, and when Called, Raise SystemexIt with the Specified Exit Code.
But the difference after all should be?
Answer 1, Authority 100%
short answer – no difference, these are objects from one class Quitter
and the difference will be only in the name:
print (quit)
# USE Quit () or Ctrl-z Plus Return to EXIT
Print (EXIT)
# USE EXIT () or Ctrl-z Plus Return to EXIT
I think quit
and exit
added for the convenience of working with the interpreter.
For more understanding you need to see the source code _sitebuiltins.py :
class quitter (Object):
Def __init __ (Self, Name, EOF):
Self.name = Name.
Self.eof = EOF.
Def __repr __ (Self):
RETURN 'USE% S () or% s to exit'% (self.name, self.eof)
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)
as well as source code site.py :
def setquit ():
"" "" Define New Builtins 'Quit' and 'Exit'.
These Are Objects Which Make The Interpreter Exit When Called.
The REPR OF EACH OBJECT CONTAINS A HINT AT How It Works.
"" "
if os.sep == '\\':
eof = 'Ctrl-z plus Return'
ELSE:
eof = 'ctrl-d (i.e. eof)'
builtins.quit = _sitebuiltins.quitter ('quit', eof)
builtins.exit = _sitebuiltins.quitter ('exit', eof)
Similar answer to SO