Working around a lack of 'goto' in python

Donn Cave donn at u.washington.edu
Wed Mar 10 12:49:35 EST 2004


In article <mailman.230.1078936428.19534.python-list at python.org>,
 gabor <gabor at z10n.net> wrote:
...
> i think the biggest problem with this exception-stuff is the naming.
> 
> the name 'exception' immediately means (for me at least) some kind of
> error condition.... 
> 
> maybe if they had a different name, it would be easier to use them also
> by non-error-conditions.

Perhaps, but my guess is that you can't win this way.  The word
in ordinary English does not mean error condition, it's simply
what does not follow the rule.  No problem for the present case,
where an early exit from a loop is a good fit.

Evidently the notion that it's an error, a catastrophe of some
dimension, must derive from its application in programming languages.
Either Python itself, or others (C++, for example.)  There's a
trend in this thread to blame the problem on C++ and Java, but
I think it's enough to program in Python for a while.  That will
expose you to a lot of situations where exceptions are used for
something you might see as an error - something really unplanned
for - and few if any calculated uses of an exception in ordinary
flow of control.

This issue is in our heads, not in the language.  In my opinion,
if we think less in terms of "error" vs. "not error", and more
in terms of the rules we apply to data and their possible exceptions,
we will have more insight into appropriate use of the feature.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list