[Python-Dev] Re: PEP-317

Guido van Rossum guido@python.org
Mon, 16 Jun 2003 21:16:27 -0400


[Guido]
> > I think not.  This is something that each project may decide for
> > itself.  But I'm at most -0 on this.

[Paul Prescod]
> The tutorial[1] implies but does not state that there are two syntaxes 
> and implies but does not state that they are basically the same. Or one 
> could get the implication that built-in exceptions use one syntax and 
> user-defined ones use the other.
> 
> I think that consistency is important to pedagogy and therefore feel 
> that it should consistently use one syntax or the other. I wish Guido 
> would pronounce that one is better than the other so that the software 
> in the library could also migrate towards being pedagogically helpful. 
> But if not, at least the tutorial can be internally consistent.

If there can be only one, then

  raise Exception()

should be it.

>   Paul Prescod
> 
> [1] http://www.python.org/doc/current/tut/node10.html

I think parts of this were written at different times.  It should
either explain the equivalence between

  raise Foo, bar

and

  raise Foo(bar)

(without going into the subtleties of what happens when bar is a Foo
instance or a tuple) or use the latter exclusively.  But I think that
it's fine at least to keep the examples that don't instantiate
explicitly, maybe explaining that

  raise KeyboardError

is short for

  raise KeyboardError()

(again, without going into the details of how the system "knows" that
-- that's not the task of the tutorial).

--Guido van Rossum (home page: http://www.python.org/~guido/)