exit() or sys.exit()

Sebastian Wiesner basti.wiesner at gmx.net
Wed Jun 17 17:41:53 EDT 2009

<Brendan – Mittwoch, 17. Juni 2009 18:15>

> What is the difference on exit() and sys.exit() when called in the
> main body of a script? From the command line they seem to have the
> same effect.

As of Python 2.5 there is no difference, however documentation [1] says 
about exit() and quit():

> They are useful for the interactive interpreter shell and should not be
> used in programs.
[1] http://docs.python.org/library/constants.html#constants-added-by-the-

Freedom is always the freedom of dissenters.
                                      (Rosa Luxemburg)

More information about the Python-list mailing list