'break' Causes Execution of Procedure?
Scott Brady Drummonds
scott.b.drummonds.nospam at intel.com
Wed Aug 11 16:29:21 EDT 2004
"Jeff Shannon" <jeff at ccvcorp.com> wrote in message
news:10hkq3u54ht2h4e at corp.supernews.com...
> I suspect that the answer is in the context of the for loop. Try
> posting a bit more of the surrounding code. (For example, it's not at
> all clear how your loop relates to the main() snippet that you posted...)
Sorry. I know that it's better to post actual failing code is much better
than snippets for exactly this reason. However, there is so much code that
I believe to be superfluous to this problem that I really wanted to make the
post simpler. To answer your question, the loop that I posted occurred in
the main() loop. That is, calling 'break' inside this loop resulted in a
call to the function that 'break' was called in (which happens to be
main()).
> Actually, I'm wondering why you catch the exception inside the loop, and
> then exit the loop. If you wrapped that entire loop in the try/except,
> then you wouldn't need to worry about using break -- an exception would
> end the loop and *then* get dealt with.
After reading your suggestion, I'm wondering why I caught the exception in
the loop as opposed to outside of the loop. I changed the implementation as
you suggested and my program is now working correctly. Of course, something
tells me that I just covered up a bug as opposed to removing it.
Scott
--
Remove .nospam from my e-mail address to mail me.
More information about the Python-list
mailing list