Anders> How do I tell try/except that I really only meant to trap
Anders> opening('file1'), but opening 'file2' is not supposed to fail so
Anders> I want any exception from that propagated? Better if I could
Anders> write:
Anders> in opening('file1') as f1:
Anders> ...
Anders> in opening('file2') as f2:
Anders> ...
Anders> else:
Anders> print "file1 not available, I'll try again later"
-1. This has the opposite meaning of the else clause in while/for
statements.
Anders> or even
Anders> in opening('file1') as f1:
Anders> ...
Anders> in opening('file2') as f2:
Anders> ...
Anders> except IOError:
Anders> print "file1 not available, I'll try again later"
Not keen on this either, maybe just because the "in" clause isn't a "try"
clause.
Skip
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com