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

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Wed Aug 9 18:23:43 EDT 2006


Bruno Desthuilliers a écrit :
> John Salerno a écrit :
> 
(snip)

or of course the dead simple:

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


BTW, you really should have a look at FormEncode...



More information about the Python-list mailing list