for: else: - any practical uses for the else clause?
mike.klaas at gmail.com
Fri Sep 29 23:22:54 CEST 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.
More information about the Python-list