[Guido, on {for,while}/else]
...
> The question remains whether Python would be easier to learn without
> them. And if so, the question would remain whether that's offset by
> their utility for experienced developers. All hard to assess
> impartially!
That's what I'm here for. I like loop "else" clauses, but have to
admit that (a) I rarely use them; (b) most of the time I use them, my
control flow is on the way to becoming so convoluted that I'm going to
rewrite the whole function soon anyway; and, (c) I've often misread
code that uses them, mentally attaching the "else" to a nearby "if"
instead.
I also suspect that if they weren't in the language already, a PEP to
introduce them would fail, because
still_looking = True
some loop:
if found it:
still_looking = False
break
if still_looking:
# what would have been in the "else" clause
is clear and easy to write without it.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com