exit a program gracefully

MRAB google at mrabarnett.plus.com
Mon May 4 18:21:06 EDT 2009

Robert.T.Lynch at seagate.com wrote:
> In a python program I ask if the user wants to continue.  If they answer 
> 'no', what options do I have to halt execution?  I can put the rest of 
> the code inside an "if bContinue:" block, but that seems awkward.  I 
> have looked at raising an exception, and perhaps this is the preferred 
> method, but it seems daunting to my non-OOP eyes.  Thanks -- Rob
What is the overall structure of the program? What happens if the user
wants to continue? If you're in a loop then you can just use 'break' to
leave the loop.

More information about the Python-list mailing list