Confused docs for 'continue' vs 'try' (Re: Another newbee question)

Tim Peters (tim@ksr.com)
Mon, 04 Apr 94 20:31:42 -0400

> I get the following error from the following code
> SyntaxError: 'continue' not properly in loop
> ...

Robin, you're not doing anything evil here, you just bumped into an
implementation restriction. Section 6.9 (The 'continue' statement) of
the Reference Manual attempts to document this, but I believe should say
instead:

'continue' may only occur syntactically nested in a 'for' or 'while'
loop, not nested in a function or class definition, and not nested in
the 'try' or 'finally' clauses of a 'try' statement (it may occur
nested in an 'except' clause of a 'try' statement though).

At least that's the way Python actually works today.

There are usually easy ways to work around this restriction, and if you
send more of the code somebody may even think of one <wink>.

continuingly y'rs - tim

Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp