3 Mar
2013
3 Mar
'13
7:06 p.m.
When dealing with files it would be nice to avoid an extra block. This is not the same as the __exit__ method because you would have to write a function to just catch an error. BTW, why not "with...except.."? Just like "for" and "while" loops have "else" clauses. with open('foo') as f: print(f.read()) except IOError: print('Problem with the file!') -- João Bernardo