[Tutor] How to exit program without sys.exit()
David
david at abbottdavid.com
Thu Dec 18 04:17:12 CET 2008
>> one other suggestion... you have a lot of functions. it's possible to
>> reduce the total number, esp. since they're pretty much all one-offs.
>> generally, you want to employ functions for code that is used more
>> than once during a single execution of your code. with your app, you
>> can probably get away with not having any functions at all.
>>
>> cheers,
>> -- wesley
I was practicing how to use a global counter and trying to understand
how functions can interact with each other. I can understand if I can
see the error's when I run the program. I know my terminology may be
hard to follow. Also I like your book :)
> So to answer your question, using sys.exit is not bad or wrong,
> but mostly you don't need to. It's better to reserve its use for occasions
> where the program has to be forced to exit early. The other place where
> you should use sys.exit() is where you want to return a specific error
> code to the Operating System - usually for other scripts to use to detect
> errors by your program.
>
> HTH,
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.freenetpages.co.uk/hp/alan.gauld
Thanks, That does HAL (help a lot). Also thanks for the tutorial/book I
have it bookmarked :)
-david
--
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
pgp.mit.edu
More information about the Tutor
mailing list