On Wed, 09 Aug 2006 18:51:04 +0000 (GMT)
John Salerno <[EMAIL PROTECTED]> wrote:

#> try:
#>      int(text)
#> except ValueError:
#>      self.error_message()
#>      return False
#> else:
#>      return True
#> 
#> I think it's much cleaner, but obviously I lost the test in the
#> original if statement.
#> 
#> So my question is, can I still retain this second structure and
#> still test for > 0, but not have any extra nesting?

How about

try:
    if int(text) > 0:
       return True
except ValueError:
    pass
self.error_message()
return False

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( [EMAIL PROTECTED] )

In 10 minutes, a hurricane releases more energy than all of the world's
nuclear weapons combined.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to