Missing exceptions in PEP 3107

Carl Banks pavlovevidence at gmail.com
Sun Aug 17 23:03:46 CEST 2008

On Aug 17, 9:34 am, Christoph Zwerschke <c... at online.de> wrote:
> Carl Banks schrieb:
> > You are free to use it for other things.  For example, the following
> > usage is obvious and sensible (insofar as listing exceptions is
> > sensible):
> > def f(x : int) -> int, raises(TypeError)
> > Think of the return value annotation as more of a function outcome
> > annotation.
> That's fine, but then this should be mentioned in the PEP3107.

Evidently the thing that really needs to be mentioned in the PEP is
"don't be pedantic".

> Instead
> it says explicitly that the "->" syntax is for "the type of a function's
> return value". If it's intended to be used in a more general way like
> you suggested, then the wording used in the PEP is misleading. (The
> wording "*the* type is problematic anyway, since a Python function can
> return different types in different situations.)

For some reason, you keep trying to interpret the PEP's description as

Once again: the PEP disclaims all authority on policy.  If the PEP
intended you to use the annotations only for what it said the
annotations were for, then it wouldn't have disclaimed that authority.

> It's still unclear for me whether annotations on thrown exceptions are
> included in PEP3107 (as per your suggestion), or are not covered by
> PEP3107 at all (as Duncan suggests), or whether this question has just
> not yet been settled.

According to the PEP you can do anything you want with the
annotations.  PEP 3107 does not specify policy.  There is no question
to settle.

If it bothers you that much, go file a bug report.  Someone might even
change it.  But it's nothing but needless pedantry.

Carl Banks

More information about the Python-list mailing list