Halt, stop, quit, exit?

John J. Lee jjl at pobox.com
Mon Oct 13 15:16:07 EDT 2003


Alex Martelli <aleax at aleax.it> writes:

> Stephen Horne wrote:
> 
> > On Mon, 13 Oct 2003 13:55:19 +0100, Simon Faulkner
> > <news at titanic.co.uk> wrote:
> > 
> >>Does Python have a command that just stops all processing?
> > 
> > Yes : sys.exit (value)
> > 
> > See the library docs for details.
> > 
> > However, IMO this is normally the wrong thing. I would normally raise
> > an exception, 
> 
> ...and that's what sys.exit does on your behalf: it raises the
> built-in exception SystemExit.  If you choose to use a raise
[...]

But if you (Simon) really want to just exit unconditionally, it's

os._exit(code)


John




More information about the Python-list mailing list