Equivalent of Java 'throws' 
Author Message
 Equivalent of Java 'throws'

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.

If there is, please point me to this; if not, that's ok too, I'll just
document the api to my class appropriately.

Thanks from a new Python convert,

Daniel Klein
Portland, OR USA



Sat, 21 Jun 2003 14:32:23 GMT  
 Equivalent of Java 'throws'

Quote:

>  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.

Nope, other than some kind of explicit documentation.

--

 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ I sidestep the either
\__/ or choices of logic and choose both. | Ken Feit
    Alcyone Systems' Daily Planet / http://www.alcyone.com/planet.html
 A new, virtual planet, every day.



Sat, 21 Jun 2003 14:42:57 GMT  
 Equivalent of Java 'throws'

Quote:

> 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



Sun, 22 Jun 2003 09:15:16 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Date manipulation and Java 'interface' equivalents

2. Equivalent to Java's Float.MAX_VALUE?

3. int('0.0') throws an exception

4. Python equivalent of shell's '$?'

5. Equivalent of RUN('File',1) with ShellExecute

6. LabVIEW's equivalent to Excel's GoalSeek method

7. Ruby equivalent 'roundup' tracking software

8. Verilog equivalent of VHDL 'for...generate'?

9. A linux equivalent to 'debug'

10. Python equivalent to 'which'?

11. Python equivalent to @lines = 'command';

12. Python equivalent to @lines = 'command'

 

 
Powered by phpBB® Forum Software