Missing exceptions in PEP 3107

Christoph Zwerschke cito at online.de
Sun Aug 17 15:56:09 CEST 2008


Terry Reedy wrote:
 > I would agree... but...
 > The problem is that code that uses a function hardly cares whether an
 > exception that replaces the normal return is raised explicitly, by a
 > syntax operation (and these are not yet completely documented, though
 > perhaps they should be), or by a function called within the function.

I often read that argument that info on thrown exceptions does not 
matter in Python, but I beg to differ. Just as a simple and well-known 
example, it is absolutely important to know that the str.index() method 
throws a ValueError if nothing is found, while the str.find() method 
should never throw a ValueError.

-- Christoph



More information about the Python-list mailing list