[Tutor] Ask a class for it's methods

Lie Ryan lie.1296 at gmail.com
Sat Dec 13 02:48:52 CET 2008


On Fri, 12 Dec 2008 20:05:23 -0500, Shrutarshi Basu wrote:

> I normally would use exceptions, because I think exceptions are a great
> idea. But since the functions may be time-consuming graphics functions
> and the lists could easily be hundreds of such calls, I don't want the
> user to sit around for something that might fail. Of course, I'm just
> starting so my assumptions about time might not turn out to be valid, so
> I could just use exceptions in the end. This is an option I'm exploring.

The general rule of thumb is usually that exception is slow on the 
exceptional cases arise, while being faster if the try block doesn't 
fail. On the other hand, using if-block is usually slow all over, but not 
as slow as exception's exceptional cases.



More information about the Tutor mailing list