The last part of that ("as e e.args[0]") is a pain to read due to no clear separation, just whitespace. On Thu Feb 13 2014 at 2:00:00 PM, Zachary Ware < zachary.ware+pyideas@gmail.com> wrote:
On Thu, Feb 13, 2014 at 12:43 PM, Amber Yust
wrote: Actually. What if we just reused 'try'?
foo = bar() except BazException try 'qux'
This also leads naturally to chaining multiple possible fallbacks:
foo = bar() except BarException try baz() except BazException try None
This is my favorite so far, followed by s/try/return/. I agree with Nathan Schneider though, it does seem odd to have "try" following "except" rather than the other way around.
What about just allowing simple try...except constructs to be condensed to a single line?
foo = try bar() except BarException as e e.args[0]
-- Zach _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/