[Tutor] Press Enter to quit. Silently maybe.

Steven D'Aprano steve at pearwood.info
Tue Mar 23 23:08:52 CET 2010

On Wed, 24 Mar 2010 07:47:40 am Wayne Watson wrote:

> I use this code to quit a completed program. 

What on earth for? If the program is complete, just quit.

In my opinion, there is very little worse than setting up a chain of 
long-running programs to run overnight, then coming back in the morning 
expecting that they will all be finished only to discover that one of 
those programs is stupidly sitting them with a "Press any key to quit" 
message, stopping all the rest from running.

In my opinion, such behaviour should be a shooting offense.


> If no is selected for 
> the yes/no prompt, warning messages appear in the shell window. I'm
> executing from IDLE. Is there a way to just return to the >>> prompt
> there?
> def finish():
>      print; print "Bye"
>      print
>      raw_input('Press Enter to quit')
>      sys.exit()

What yes/no prompt? How do you select No?

Steven D'Aprano

More information about the Tutor mailing list