[Python-ideas] except expression

Chris Angelico rosuav at gmail.com
Wed Feb 19 16:06:51 CET 2014


On Thu, Feb 20, 2014 at 1:48 AM, Oscar Benjamin
<oscar.j.benjamin at gmail.com> wrote:
> This proposal is similar but it's
> hard to find the cases that would be simplified by it as they will
> probably be written in a very different way right now.

If they're written the way you describe, with a "try" block that
assigns to something and an "except" block that assigns to the exact
same thing, my script will find them. You might want to disable (by
commenting out) some of the handlers at the top; the ast.Expr one, in
particular, tends to generate a lot of spam.

https://github.com/Rosuav/ExceptExpr/blob/master/find_except_expr.py

ChrisA


More information about the Python-ideas mailing list