On 7/23/2010 5:46 PM, Nobody wrote:
On Fri, 23 Jul 2010 10:42:26 +0000, Steven D'Aprano wrote:

Don't write bare excepts, always catch the error you want and nothing
else.

That advice would make more sense if it was possible to know which
exceptions could be raised. In practice, that isn't possible, as the
documentation seldom provides this information. Even for the built-in
classes, the documentation is weak in this regard; for less important
modules and third-party libraries, it's entirely absent.

I intend to bring that issue up on pydev list sometime. But in the meanwhile, once you get an error, you know what it is. You can intentionally feed code bad data and see what you get. And then maybe add a test to make sure your code traps such errors.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to