On Sat, 27 Jan 2007 01:03:50 -0300, Gabriel Genellina wrote: > "Steven D'Aprano" <[EMAIL PROTECTED]> escribió en el > mensaje > news:[EMAIL PROTECTED] > >> On Fri, 26 Jan 2007 17:25:37 +0100, Bruno Desthuilliers wrote: >>>> def __del__(self): >>>> try: >>>> self.close() >>>> finally: >>>> pass >>>> except: >>>> pass >>> >>> The finally clause is useless here. >> >> In principle, closing a file could raise an exception. I've never seen it >> happen, but it could. From the Linux man pages: [...] >> I assume that the same will apply in Python. > > Note that he said that the *finally* clause were useless (and I'd say so, > too), not the *except* clause.
Doh! Yes, he's right. Worse, the code as show can't possibly work: the finally clause must come AFTER the except clause. >>> try: ... pass ... finally: ... pass ... except: File "<stdin>", line 5 except: ^ SyntaxError: invalid syntax -- Steven. -- http://mail.python.org/mailman/listinfo/python-list