For this case, just wanting to stop the code for testing, using a short statement as the arg is not only OK it is an example in the doc.
exit( [arg]) Exit from Python. ...... In particular, sys.exit("some error message") is a quick way to exit a program when an error occurs. I agree I should be a bit more careful about giving examples that are quick fixes as opposed to best practice. John -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hugo González Monteverde Sent: Wednesday, May 03, 2006 12:05 PM To: tutor@python.org Subject: Re: [Tutor] Halting execution It would be similar to Perl's die() commmand. But no, in Python the argument is the error status of your script. You'd have to do something like def exitnow(arg): print arg #maybe sys has not been imported import sys sys.exit(1) Hugo Ertl, John wrote: > Matthew, > > Not sure if ipython is different but have you tried sys.exit("stoping now") > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor