[Python-ideas] for/except/else syntax

Yuvgoog Greenle ubershmekel at gmail.com
Thu Oct 8 10:52:04 CEST 2009


-1 on for...then
Everything after the for loop is a "then":

for i in SEQ:
    A
# then
# code follows

The special thing about "else" is that it's skipped upon break. That's the
*one and only* use case.

Since the current "else" clause only tests for "if not break", I think
spelling it out somehow could extremely improve "else" readability.

+1 for improving the readability of "for..break..else" and not just putting
the confusion under a "then" rug.

--yuv
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20091008/509b9469/attachment.html>


More information about the Python-ideas mailing list