[Python-Dev] PEP 463: Exception-catching expressions

Eric Snow ericsnowcurrently at gmail.com
Fri Feb 21 17:52:53 CET 2014

On Fri, Feb 21, 2014 at 8:19 AM, Brett Cannon <brett at python.org> wrote:
> I understand you are arguing that a try expression will lead to people just
> doing `something() except Exception: None` or whatever and that people will
> simply get lazy and not think about what they are doing with their
> exceptions.


> Unfortunately they already are; that shipped sailed when we
> didn't eliminate bare except clauses in Python 3 (hopefully we can change
> that in Python 4).

We should have a page somewhere tracking a py4k "wishlist". :)

> I personally don't think that making people type out a try statement is
> going to lead to that much thought compared to an expression. I'm willing to
> bet most IDEs have a code snippet for creating a try statement so people are
> already not using the extra typing of a full-blown statement with at least
> two clauses as a way to stop and think about what they are doing.
> I'm totally fine restricting this proposal to not having any concept of
> exception catching or finally clause: it just replaces the simplest
> try/except clause possible (while requiring an exception be specified). That
> takes care of the common control flow use case of exceptions while requiring
> more thought for more complex cases.



More information about the Python-Dev mailing list