exception handling in complex Python programs

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Thu Aug 21 22:54:43 CEST 2008


magloca a écrit :
> Bruno Desthuilliers @ Thursday 21 August 2008 17:31:
> 
>>>> If you mean "the exceptions *explicitely raised* by your code", then
>>>> I agree. But with any generic enough code, documenting any possible
>>>> exception that could be raised by lower layers, objects passed in as
>>>> arguments etc is just plain impossible. Like, if you have a function
>>>> that takes a file-like object as arg, you just cannot know in
>>>> advance what exceptions this object might raise.
>>>>
>>> This is one of the main concerns with which I started this c.l.py
>>> thread ! I think it's a pity that we have no way of anticipating and
>>> constraining the exceptions thrown by our code,
>> Java's "checked exception" system has proven to be a total disaster.
> 
> Could you elaborate on that? I'm not disagreeing with you (or agreeing,
> for that matter); I'd just really like to know what you mean by
> a "total disaster."

One of the most (in)famous Java coding pattern is the empty catchall 
clause. Read Chris Mellon and Richard Levasseur posts in this thread for 
more details - they already covered the whole point.



More information about the Python-list mailing list