In message <[EMAIL PROTECTED]>, Tim Arnold wrote: > try: > s.connect((cpu,7)) > except: > return 0 > try: > s.send('test') > s.recv(128) > s.close() > return 1 > except: > return 0
Call me nervous, but I like to make my "except" clauses as specific as possible, to catch only the errors I'm expecting. This is to minimize the chance of some hidden bug sneaking through and causing the wrong behaviour. > > try: > rup = os.popen('rup %s | sort -n -t, -k4 | grep day' % > (self.asString)) > except OSError: > return self.asList So if the rup call fails, you're returning a plain list of all the hostnames? Won't this cause the following parsing to fail? If you're going to trigger a failure, isn't it better for it to happen as close as possible to the actual cause? In other words, take out the try/except block above and let the os.popen call itself directly signal an exception on failure. Disclaimer: I've never actually used rup. :) -- http://mail.python.org/mailman/listinfo/python-list