Missing exceptions in PEP 3107

Christoph Zwerschke cito at online.de
Fri Aug 15 15:42:59 EDT 2008


Carl Banks wrote:
 > I think you're missing the point here. PEP 3017 is policy-neutral:
 > it describes a mechanism to annotate functions and arguments,
 > and that's it.

That's not quite true: PEP 3017 describes a mechanism for annotating 
function parameters *and return values*, and my point was why it does 
not provide a mechanism for annotating thrown exceptions, since I see 
info on thrown exceptions in the same category as info on return values.

 > IOW, there is currently no recommended way to do *anything* with
 > annotations(**).  That is entirely left up to users and third-party
 > packages, and the PEP goes out of its way to disclaim all authority on
 > policy.  The following quote from the PEP sums it up well:
 >
 > "Following from point 2, this PEP makes no attempt to introduce any
 > kind of standard semantics, even for the built-in types. This work
 > will be left to third-party libraries."

That's right, the PEP does not say how the information is to be 
*interpreted*, but it does say what the information is *about* (e.g. a 
certain parameter or the return value). In the same way, you could make 
annotations about thrown exceptions without actually defining how this 
information should be interpreted.

 > Your concern is misplaced; it just doesn't belong in the PEP.

Call me slow on the uptake, but I still think that if you discuss 
function annotations and ways of specifying info on return values, then 
ways of specifying thrown exceptions belong into the same discussion. I 
understand if you say that for organizational/workflow reasons, the PEP 
cannot be altered or supplemented any more since it has reached the 
"final" status. But as regards contents, I still think it belongs there.

 > (**) - Actually there is a minor policy recommendation: that the pydoc
 > and inspect module learn to understand and display the annotations.

What do you mean with "understand" here when no semantics exists? Do you 
mean that they should just be able to parse and display them, or that 
they should start to define the semantics?

-- Christoph



More information about the Python-list mailing list