"Aggelos I. Orfanakos" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks. This should now be OK: > > #try: > # try: > # s = ... # socket opens > # > # # various code ... > # except socket.error, x: > # # exception handling > #finally: > # s.close() # socket closes >
Why the nested try's? If I understand your intention correctly this should do the same thing: try: s = ... # socket opens # various code ... except socket.error, x: # exception handling s.close() # socket closes You would need the try-finally statement only if you expect it to handle other exceptions than socket.error or if the socket.error is re-raised in the "except" clause. Otherwise, the try-finally statement is redundant because no socket.error are getting out of the try-except statement. Dan -- http://mail.python.org/mailman/listinfo/python-list