python "jump" or "goto" commands?
jkraska1 at san.rr.com
Fri Jun 1 02:39:45 CEST 2001
>> for i in range(100):
>> for j in range(100):
>> if i*j > 2500:
>> raise Label
>> except Label:
>Or a function with a return statement.. that personally feels a cleaner to me.
This works poorly in the event that several exit points require cleanup of
some kind. In C, I often favor constructs of the form:
if (bad) goto bail;
Log(logger, "something bad happened\n");
Where numerous conditions can move you to the bail-out point. This
is, of course, trumped by an exception in Python.
More information about the Python-list