[Python-ideas] Updating PEP 315: do-while loops

Bruce Leban bruce at leapyear.org
Mon Apr 27 06:52:30 CEST 2009


I think a legitimate issue here is that break and continue can be hard to
see sometimes when they're nested several layers deep. That makes while
True: ... if x: break less clear than it could be. So let me throw out two
straw proposals:

(1) Allow break and continue to be spelled BREAK and CONTINUE which makes
them stand out a bit more.

    while True:
        floob
        yuzz
        if wum:
            BREAK
        thnad

(2) Allow a line containing break or continue to start with a -> token
outside the normal indentation.

    while True:
        floob
        yuzz
        if wum:
    ->      break
        thnad

I don't expect either of these proposals to attract support. I present them
to put a small focus on the issue of making break/continue more visible.

--- Bruce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090426/f6c9d528/attachment.html>


More information about the Python-ideas mailing list