1.5.2 for: else:

Fredrik Lundh fredrik at pythonware.com
Fri Jul 30 04:38:01 EDT 1999


William Tanksley <wtanksle at dolphin.openprojects.net> wrote:
> >for ALL these statements, the else clause is exe-
> >cuted if and only if ALL controlling expressions
> >evaluate to FALSE.
> 
> But that's not even superficially true for the current behavior of a loop.
> A loop's else clause is executed even when there were TRUE results of the
> controlling expressions.

huh?  there's only ONE *controlling* expression in
the loop: the internal test that checks if the
sequence has any more items. the else clause
is executed if and only if THAT expression eval-
Traceback (innermost last):
  File "effbot.py", line 12032, in effbot
  File "effbot.py", line 3428, in generate_reply
    raise ImpedanceMismatch # bailing out
effbot.ImpedanceMismatch





More information about the Python-list mailing list