[Python-ideas] except expression

Amber Yust amber.yust at gmail.com
Thu Feb 13 23:02:23 CET 2014


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 at gmail.com> wrote:

> On Thu, Feb 13, 2014 at 12:43 PM, Amber Yust <amber.yust at gmail.com> 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 at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140213/0ce0716d/attachment.html>


More information about the Python-ideas mailing list