Equivalent of Java 'throws'

Neelakantan Krishnaswami neelk at alum.mit.edu
Tue Jan 2 20:15:16 EST 2001


On Mon, 01 Jan 2001 22:32:23 -0800, Daniel Klein <danielk at aracnet.com> wrote:
> Here's another 'is there a Pythonic way to do this' question...
>
> In Java, you can specify a 'throws' to tell a client using your
> methods of your class that they must have an exception handler. This
> appears to be checked when the client is compiled.
>
> I've read thru the reference materials concerning exceptions and
> this one's got me stumped.  Is there any way in Python to do this? I
> suspect there isn't since Python is dynamically typed.

Put a note in the docstring. If you don't write docstrings, get in the
habit! They are one of the most useful little features of Python.


Neel



More information about the Python-list mailing list