[Tutor] a graceful program exit

James Mills prologic at shortcircuit.net.au
Thu Aug 12 06:06:57 CEST 2010


On Thu, Aug 12, 2010 at 1:42 PM, Bill Allen <wallenpb at gmail.com> wrote:
> I have only learned a couple of ways to cause a Python program to exit:
> sys.exit(0)  &  raise.SystemExit .  I am using this in a try/except block.
> Which is preferred?  Are there other, better ways?

The normal pattern is to have an entry point and an exit point.

main() and SystemExit exception.

cheers
James

-- 
-- James Mills
--
-- "Problems are solved by method"


More information about the Tutor mailing list