Who needs exceptions (was Re: Two languages, too similar, competing in the same space.)

Ville Vainio vvainio at karhu.tp.spt.fi
Wed Jan 2 13:11:16 CET 2002

Oleg Broytmann <phd at phd.pp.ru> writes:

>    file = open(...)
>    if not file: report_error()

One great thing about exceptions as opposed to retval-checking is that
when you are making the initial version, you don't have to implement
error-checking at all! Whenever something weird happens, you will know
where and why it happened through the traceback. And when you do
implement error checking, you can do that for errors you can recover
from. It's ok for fatal & unexpected errors to crash the program, as
long as you know what happened. Simply put, exceptions reduce tedious,
stereotypical if (command) || die() code. 

Ville Vainio - http://www.tp.spt.fi/~vvainio - ICQ #115524762
 Wild geese have no intention to cast a reflection
 Water has no mind to assume their form

More information about the Python-list mailing list