Slawomir Nowaczyk wrote: > > try: > if int(text) > 0: > return True > except ValueError: > pass > self.error_message() > return False >
Nicely DRY. To make it even more compact, it may be noticed that the default return value None is false in a boolean context - so that the last line is superfluous if the return value is only wanted to test it in such a context. -- http://mail.python.org/mailman/listinfo/python-list