[Edu-sig] What do files and exceptions have in common?

Arthur ajsiegel at optonline.net
Mon Nov 8 14:45:17 CET 2004

On Sun, 2004-11-07 at 19:56 -0600, John Zelle wrote:

> I like to talk about exceptions as a special kind of decision structure 
> (in languages w/o exceptions, you would check returned error codes with 
> ifs). So I put exceptions into a chapter on decisions (ifs).

That makes sense to me. In that what one wants to communicate about
exceptions is that they are not necessarily exceptional or unexpected. 

And can be used, as you say, as part of a decision structure.

I recently needed to convert a large ascii report from a legacy system
and turn it into data.  I was not working in Python.  What ended up
making sense is trying to convert a certain range of positions of each
line to a date, relying on the fact that I would get errors on  the
conversion attempt for the lines that did not contain the data I was
trying to process

But it tends to be a somewhat advanced topic.  I found in my most recent
refactoring of PyGeo that a number of bugs had been hidden and/or
created by sloppy use of exceptions. In other words, it took me a while
to catch on.

One of the reasons VB had seemed so primitive to me - coming from Python
- was its very limited facility with exceptions.  I think VB.Net deals
with this to a decent extent. 


More information about the Edu-sig mailing list