for: else: - any practical uses for the else clause?
Mike Klaas
mike.klaas at gmail.com
Fri Sep 29 17:22:54 EDT 2006
On 9/29/06, Johan Steyn <johan.steyn at gmail.com> wrote:
> On 29 Sep 2006 11:26:10 -0700, Klaas <mike.klaas at gmail.com> wrote:
>
> > else: does not trigger when there is no data on which to iterate, but
> > when the loop terminated normally (ie., wasn't break-ed out). It is
> > meaningless without break.
>
> The else clause *is* executed when there is no data on which to iterate.
> Your example even demonstrates that clearly:
Yes--there is a missing "just" in that sentence.
-Mike
More information about the Python-list
mailing list