An interesting idea, although I suspect a leading try keyword would make
things clearer.
(try expr1 except expr2 if exc_type)
print (try letters[7] except "N/A" if IndexError)
f = (try open(filename) except open(filename2) if IOError)
print (try eval(expr) except "Can not divide by zero!" if ZeroDivisionError)
val = (try db.get(key) except cache.get(key) if TimeoutError)
This wouldn't help the chaining problem that Greg pointed out, though:
try open(name1) except (try open(name2) except open(name3) if IOError) if
IOError
Using a different keyword or a comma so expr2 comes last as Greg suggested
would fix that:
try open(name1) except IOError, (try open(name2) except IOError, open(name3))
I'd be somewhere between -1 and -0 at this point in time. Depending on the
results a review of the standard library describing actual use cases that
could be made easier to read might be enough to get me to a +0.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com