defining classes within loops?

Jeff Shannon jeff at ccvcorp.com
Thu Aug 2 13:25:43 EDT 2001


Roy Smith wrote:

> The documentation for the "continue" statement says:
>
> > continue may only occur syntactically nested in a for or while loop,
> > but not nested in a function or class definition
>
> Just out of curiosity, how many people have ever written a function or
> class definition nested inside a loop?  Seems like sort of a strange thing
> to do, although I suppose it might be useful in some situations.

I don't think the docs are intending to imply anything about defining
functions/classes within a loop.  I think that it is could be paraphrased
as:   "continue must be nested within a block, but that block must be a for or
while loop; the nesting block cannot be a function or class definition."

Jeff Shannon
Technician/Programmer
Credit International





More information about the Python-list mailing list