converting a nested try/except statement into try/except/else

John Salerno johnjsal at NOSPAMgmail.com
Thu Aug 10 10:22:56 EDT 2006


Bruno Desthuilliers wrote:

>      try:
>          if int(text) <= 0: raise ValueError
>      except ValueError:
>          self.error_message()
>          return False
>      else:
>          return True

Nice! Thanks!



More information about the Python-list mailing list