[Python-ideas] Arguments to exceptions

Steven D'Aprano steve at pearwood.info
Wed Jul 5 13:32:21 EDT 2017


On Wed, Jul 05, 2017 at 04:12:29PM +0000, Ed Kellett wrote:
> Hi,
> 
> On Wed, 5 Jul 2017 at 16:41 Steven D'Aprano <steve at pearwood.info> wrote:
> 
> > and more. Third parties *are* providing rich exception APIs where it
> > makes sense to do so, using the interface encouraged by PEP 352 (named
> > attributes), without needing a default "StructuredException" in the
> > core language.
> >
> 
> Your arguments might be used to dismiss anything.

Do you have an answer for why the argument is wrong? People *are* 
writing structured exceptions, which undercuts the argument that we must 
do something because if we don't lead the way others won't.

The argument that "we must do something, this is something, therefore we 
must do it" doesn't cut any ice here. Read the Zen of Python:

    Now is better than never.
    Although never is often better than *right* now.

The burden is not on me to prove that this idea is a bad idea. I don't 
have to prove this is a bad idea. The burden is on those who want to 
make this change to demonstrate to the satisfaction of the core 
developers that their idea:

- solves a genuine problem;

- without introducing worse problems;

- that it will do what they expect it to do;

- and that the change is worth the effort in implementation 
  and the cost to the language (bloat and churn).

If proponents of the idea can't do that, then the status quo wins:

http://www.curiousefficiency.org/posts/2011/02/status-quo-wins-stalemate.html


I've had a number private emails complaining that I'm "too negative" for 
this list because I pointed out flaws. Do people think that we make 
Python better by introducing flawed changes that don't solve the problem 
they're supposed to solve?

(I'm not going to name names, you know who you are.)

If people want this change, it's not enough to get all snarky and 
complain that critics are "too negative" or "too critical of minor 
problems". You need to start by **addressing the criticism**.

In the very first reply to Ken's initial proposal, it was pointed out 
that his plan goes against PEP 352 and that he would have to address why 
that PEP is wrong to encourage named attributes over positional 
arguments in exception.args. As far as I can see, nobody has even 
attempted to do that.

I think that's the place to start: if your plan for giving exceptions 
structure is to just dump everything into an unstructured args list with 
no guaranteed order, then you're not actually giving exceptions 
structure and you're not solving the problem. 




 (like the fact that the 
idea 
doesn't actually solve the 
problem 
it is intended to).



You know what? I don't have to prove anything here. It's up to the 
people wanting this change to prove that it is useful, worth the 
effort, and that it will do what they expect.

Ken suggested a concrete change to BaseException to solve a real lack. 
His solution can't work, for reasons I've already gone over, but at 
least he's made an attempt at a solution. (He hasn't demonstrated that 
there is a real problem




 If people are already
> doing $thing, clearly they don't need help from the language. If they're
> not already doing it, any language feature would be pointless.
> 
> Ed


More information about the Python-ideas mailing list