[Python-ideas] except expression

Zachary Ware zachary.ware+pyideas at gmail.com
Thu Feb 13 23:11:15 CET 2014


On Thu, Feb 13, 2014 at 4:02 PM, Amber Yust <amber.yust at gmail.com> wrote:
<cut>
> On Thu Feb 13 2014 at 2:00:00 PM, Zachary Ware
> <zachary.ware+pyideas at gmail.com> wrote:
>> 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]
<paste>
> The last part of that ("as e e.args[0]") is a pain to read due to no clear
> separation, just whitespace.

I don't disagree, but it's less bad than some of the other
alternatives :).  It's also not quite as bad when not using the
exception (which I suspect would be somewhat more common):

   foo = try bar() except BarException "default"

-- 
Zach

PS: I know Gmail makes it harder than it needs to be, but could you
please try to avoid top-posting?  (This topic doesn't need to be
derailed into another debate about top-posting though, so please
either follow this suggestion or ignore it entirely :))


More information about the Python-ideas mailing list