[Python-Dev] more pyref: continue in finally statements

Fredrik Lundh fredrik at pythonware.com
Mon May 1 20:11:08 CEST 2006


the language reference says:

    continue may only occur syntactically nested in a for or while loop,
    but not nested in a function or class definition or finally statement
    within that loop. /.../

    It may occur within an except or else clause. The restriction on occurring
    in the try clause is implementor's laziness and will eventually be lifted.

and it looks like the new compiler still has the same issue:

    $ python test.py
        File "test.py", line 5:
            continue
    SyntaxError: 'continue' not supported inside 'finally' clause

how hard would it be to fix this ?

(shouldn't the "try clause" in the note read "finally clause", btw?  "continue"
within the "try" suite seem to work just fine...)

</F>





More information about the Python-Dev mailing list