[Nicola Larosa]
> ... I sometimes may have had a need for the current semantics
> of the else after loops, but I don't remember it; on the other hand, I have
> had a use for the no-iteration case a number of times. Somehow I find it
> hard to stick into my mind that's not what it means.

The primary use case is "search loops".

for item in sequence:
    if desirable(item):
        break
else:
    no desirable item exists

Just remember "search loop", and you'll never be surprised again.  Now
go back and recode your search loops in this simpler way ;-)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to