breaking from loop
Sybren Stuvel
sybrenUSE at YOURthirdtower.com.imagination
Fri Feb 10 02:50:42 EST 2006
Ritesh Raj Sarraf enlightened us with:
> bFound = True
> break
> return bFound
I see two weird things. First of all, the retun statement won't be
reached due to the break before it. Let's assume the break isn't
needed, and you want just the return. Why set the variable if you're
going to return anyway? I'd change those three lines to "return True".
> But since test directory is under temp, work_tree_copy makes two
> calls of the same function _but_ break only is able to get out from
> the inner call.
Raise an exception and catch it at the outer level.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa
More information about the Python-list
mailing list