does python have a halt statement?

fredrik at pythonware.com fredrik at pythonware.com
Thu Nov 16 13:02:14 CET 2000


stevecanfield at my-deja.com wrote:
> I'm just getting started writing my first non-toy python program
> and I am stumped immediately by an embarassingly simple problem-
> how to I halt execution?

sys.exit()

(or if you prefer, raise SystemExit)

> And why isn't return legal here?  Am I not in an
> fucntion implicitly named __main__?

you're executing code in a module named __main__, but
a module namespace isn't the same thing as a function.
for some more info, see the section called "What Does
Python Do to Import a Module?" in this mini guide:

   http://www.pythonware.com/people/fredrik/fyi/fyi06.htm

</F>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list