[Python-ideas] "while ... try" - block or "for ... try" - block

Yuval Greenfield ubershmekel at gmail.com
Thu Jan 12 01:13:09 CET 2012

I also only see trouble with this construct.

I initially assumed you meant:

    while expr try:
        # ...
    except IOError:
        print 'error'

would actually equal:

        while expr:
            # ...
    except IOError:
        print 'error'

This makes sense because the "except" is after the while loop suite so it
should mean that being in the except suite removes the possibility of
reentering the while suite.

Anyhow, because of the ambiguity, and because we'll immediately need
for/try if/try and try comprehensions (some of which have contradicting
"else" semantics) I'm -2 on this.

Yuval Greenfield
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120112/8cb1ed71/attachment.html>

More information about the Python-ideas mailing list