On Tue, Jul 8, 2014 at 7:03 PM, Steven D'Aprano <st...@pearwood.info> wrote: > On Mon, 07 Jul 2014 14:49:56 -0400, Terry Reedy wrote: > >> Avoid EOFError. Much better, I think, is the somewhat customary >> >> s = input("Enter something, or hit <return> to exit") if not s: >> sys.exit() >> else: <process s> > > Under many circumstances, I would do exactly that. But sometimes an empty > string is valid data, not a signal for special processing (whether > exiting the application, or something else).
Or you want to have two different signals: empty string means "use the default", and something else means "exit the application now please". Very common. ChrisA -- https://mail.python.org/mailman/listinfo/python-list