What if the user enters "maybe".

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf
Of Alan Gauld
Sent: Thursday, June 07, 2007 1:45 AM
To: tutor@python.org
Subject: Re: [Tutor] Engarde program was: i++



"David Heiser" <[EMAIL PROTECTED]> wrote 
> 
> def is_yes(question):
>     while True:
>         try:
>             s = raw_input(question).lower()[0]
>             if s == 'y':
>                 return True
>             elif s == 'n':
>                 return False
>         except:
>             pass     ## This traps the condition where a user just
> presses enter
>         print '\nplease select y, n, yes, or no\n'

What value do you think the pass adds over just having 
the print statement inside the except block? So far as I can 
tell they will both do exactly the same so the pass is 
not needed. Or am I missing something here?

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to