"while/else" (ugh) (was Re: [oclug] Ruby)
David F. Skoll
dfs at roaringpenguin.com
Fri Jun 27 12:58:00 EDT 2003
On Fri, 27 Jun 2003, Rod Giffin wrote:
> > while not found:
> > line = fp.readline()
> > if not line: break
> > if re.search(pattern, line):
> > found = True
> > else:
> > print "we didn't find the pattern"
Am I the only one who finds that repugnant?
When, exactly, does the "else" fire? If the loop is iterated zero times?
If the loop is ever exited with "found" still false?
More information about the OCLUG