Python and checked exceptions

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Sat Sep 23 08:01:34 EDT 2006


In message <1159009493.872015.33880 at d34g2000cwd.googlegroups.com>, Kay
Schluehr wrote:

> A new cookbook recipe suggesting two decorators @throws and @catches
> for treatment of checked exceptions in Python:
> 
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498131
> 
> This might be of practical interest for some and theoretical interest
> for others - in particular those who know checked ex as a language
> feature of Java.

The trouble with having to declare every possible exception that a function
might throw is that it rapidly turns into a complete mess. That's why such
declarations are optional in C++, and only semi-mandatory in Java.



More information about the Python-list mailing list