[Python-ideas] except expression

Chris Angelico rosuav at gmail.com
Tue Feb 18 19:21:21 CET 2014


On Wed, Feb 19, 2014 at 5:13 AM, Andrew Barnert <abarnert at yahoo.com> wrote:
> On Feb 18, 2014, at 9:49, Chris Angelico <rosuav at gmail.com> wrote:
>
>> On Wed, Feb 19, 2014 at 4:45 AM, Andrew Barnert <abarnert at yahoo.com> wrote:
>>> The fact that neither of them mentioned KeyError or IndexError, which are
>>> the two paradigm cases that brought up the proposal in the first place,
>>> implies to me that any attempt to define a collection of "expression errors"
>>> is going to be as hard and as contentious as coming up with a syntax.
>>
>> Both of us mentioned LookupError, which is superclass to both KeyError
>> and IndexError, and so catches both of them.
>
> Sorry, I didn't see LookupError in your list. But it's clearly there. NotEnoughCoffeeError.

Though you do (effectively) raise another objection to that proposal,
namely that programmers will never be quite sure what's caught and
what's not. It'll become magic. Can you, without looking anything up,
name all the exception types that would be caught by (LookupError,
UnicodeError, OSError) ? And that's only part of my list.

ChrisA


More information about the Python-ideas mailing list