In the code below try is used to check if handle has the attribute name. It seems an if statement could be used. Is there reason one way would be better than another?
def write_header(self): handle = self.handle try: handle.write("# Report_file: %s\n" % handle.name) except AttributeError: pass handle.write("########################################\n") The specific use case I noticed this was https://github.com/biopython/biopython/blob/master/Bio/AlignIO/EmbossIO.py#L38 Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list