S
Simon Faulkner
Does Python have a command that just stops all processing?
Simon
Simon
Does Python have a command that just stops all processing?
Simon said:Does Python have a command that just stops all processing?
Stephen said: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 the outer level of processing would have a try block
that catches all exceptions (by name for those which can be
anticipated) reporting details of why the program stopped.
Should you decide that later that you only want to abort part of your
app (e.g. to go back to the main menu), an exception can handle this
quite naturally.
[...]Alex Martelli said:...and that's what sys.exit does on your behalf: it raises the
built-in exception SystemExit. If you choose to use a raise
Simon said:Does Python have a command that just stops all processing?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.