Using the Python Interpreter as a Reference

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Nov 28 17:57:47 EST 2011


On Mon, 28 Nov 2011 13:29:06 -0800, Travis Parks wrote:

> Exception handling is one of those subjects few understand and fewer can
> implement properly in modern code. Languages that don't support
> exceptions as part of their signature lead to capturing generic
> Exception all throughout code. It is one of those features I wish .NET
> had. At the same time, with my limited experience with Java, it has been
> a massive annoyance. Perhaps something to provide or just shut off via a
> command line parameter. What indications have there been that this has
> been a flaw? I can see it alienating a large group of up- and-coming
> developers.

http://www.ibm.com/developerworks/java/library/j-jtp05254/index.html

Note also that Bruce Eckel repeats a rumour that checked exceptions were 
*literally* an experiment snuck into the Java language while James 
Gosling was away on holiday.

http://www.mindview.net/Etc/Discussions/UnCheckedExceptionComments

Even if that is not true, checked exceptions are a feature that *in 
practice* seems to lead to poor exception handling and cruft needed only 
to satisfy the compiler:

http://www.alittlemadness.com/2008/03/12/checked-exceptions-failed-experiment/#comment-219143

and other annoyances. It's main appeal, it seems to me, is to give a 
false sense of security to Java developers who fail to realise that under 
certain circumstances Java will raise certain checked exceptions *even if 
they are not declared*. E.g. null pointer exceptions.

See also:

http://java.dzone.com/articles/checked-exceptions-i-love-you

and note especially the comment from the coder who says that he simply 
declares his functions to throw Exception (the most generic checked 
exception), thus defeating the whole point of checked exceptions.


-- 
Steven



More information about the Python-list mailing list