How to break out of two nested for loops?
Paul Prescod
paul at prescod.net
Thu Jan 24 09:53:11 EST 2002
Justin Sheehy wrote:
>
>...
>
> The for-loop construct in Python uses exceptions for termination. Doing
> so by hand is clearly in line with language idiom.
Python's implementation also makes use of "goto" quite a bit.
And if you want to "go to" a particular place in the code then why would
an exception be a clearer way to do that? I think that the original
poster was correct in saying that exceptions are about as readable or
unreadable as a goto. Used properly, either is not bad. Used improperly,
either is a nightmare. I can understand a wish to avoid (ab)using
exceptions in this way.
Paul Prescod
More information about the Python-list
mailing list